def testEncryptionDefault(self): ''' This will test for the default encryption ''' api = EncryptionUtil() print "%s" % (api.encryptText()) self.assertTrue(True, 'true')
def testDecryptionDefault(self): ''' This will test for default decryption ''' api = EncryptionUtil() logger.info(api.decryptText('AzI/oNiKjDICLJqApFuCUN7arGJ4oOR%2BhH1pT0EehB4%3D')) self.assertTrue(True, 'true')
def testEncryptionDefault(self): ''' This will test for the default encryption ''' api = EncryptionUtil() print "%s" %(api.encryptText()) self.assertTrue(True, 'true')
def testDecryptionDefault(self): ''' This will test for default decryption ''' api = EncryptionUtil() logger.info( api.decryptText( 'AzI/oNiKjDICLJqApFuCUN7arGJ4oOR%2BhH1pT0EehB4%3D')) self.assertTrue(True, 'true')
def buildAuthenticateParam(self, res_msg): ''' This will build the authentication get message to be sent to the called page, all data needs to be encrypted this will encrypt the token and auth details and form as string and returns @param res_msg: Auth Dictionary @return: A string containing the authentication details as Get Parameter ''' from django.conf import settings PRV_ENC_KEY = getattr(settings, "PRV_ENC_KEY", 'n'); from ui_utilities.dsutilities import DSUtility # First AUth ID auth_id = DSUtility().getlistitem(res_msg, 'authid'); from encryption.uiencrypt import EncryptionUtil authIdApi = EncryptionUtil(PRV_ENC_KEY); auth_id = authIdApi.encryptText(auth_id); # Second Prev AUth ID prv_auth_id = DSUtility().getlistitem(res_msg, 'prvauthid'); prv_auth_id = authIdApi.encryptText(prv_auth_id); # 3 Token token = DSUtility().getlistitem(res_msg, 'token'); token = authIdApi.encryptText(token); # 4 Prev Token prv_token = DSUtility().getlistitem(res_msg, 'prvtoken'); prv_token = authIdApi.encryptText(prv_token); # 5 Profile ID prf_id = DSUtility().getlistitem(res_msg, 'prfid'); prf_id = authIdApi.encryptText(prf_id); return 'au=%s&pau=%s&tn=%s&ptn=%s&pi=' %(auth_id, prv_auth_id, token, prv_token, prf_id);
def testGenratePubProfileId(self): api = EncryptionUtil(self.PUB_PRF_ID_ENC_KEY) print 'public profile id- %s' % (api.encryptText('123'))
def testGenratePrivateToken(self): api = EncryptionUtil(self.PRV_ENC_KEY) print 'private toekn- %s' % (api.encryptText('abc'))
def testGenratePubToken(self): api = EncryptionUtil(self.PUB_ENC_KEY) print 'public token- %s' % (api.encryptText('abc'))
def testgenratepwd(self): ''' This will genrate the password key ''' api = EncryptionUtil(self.PASSWORD_KEY) print 'pwdt- %s' % (api.encryptText('test'))
def testGenratePubProfileId(self): api = EncryptionUtil(self.PUB_PRF_ID_ENC_KEY) print 'public profile id- %s' %(api.encryptText('123'))
def testGenratePrivateToken(self): api = EncryptionUtil(self.PRV_ENC_KEY) print 'private toekn- %s' %(api.encryptText('abc'))
def testGenratePubToken(self): api = EncryptionUtil(self.PUB_ENC_KEY) print 'public token- %s' %(api.encryptText('abc'))
def testgenratepwd(self): ''' This will genrate the password key ''' api = EncryptionUtil(self.PASSWORD_KEY) print 'pwdt- %s' %(api.encryptText('test'))