~vomun-developers/anonplus/vomun-trunk

« back to all changes in this revision

Viewing changes to src/libs/encryption/rsa.py

  • Committer: AJ00200
  • Date: 2011-11-20 16:42:48 UTC
  • Revision ID: git-v1:c208e855a3c80c6eb20109fad027748a847e6a39
Encryption code is now working again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
        '''Encrypt `data` with this encryption algorithm.'''
25
25
        print(' * Encrypting: %s' % data)
26
26
        edata = keys[self.dest].encrypt(data, '')
27
 
        print(' * Type encry: %s' % type(edata))
28
 
        print(' * Encrypted : %s' % edata[0])
 
27
        if str(type(edata)) == "<type 'tuple'>":
 
28
            print('  * edata is a tuple:')
 
29
            print('  * Encr tuple: %s' % str(edata))
 
30
        print('')
 
31
        print(' * edata[0]  : %s' % edata[0])
29
32
        return edata[0]
30
33
 
31
34
    def decrypt(self, data):
32
35
        '''Decrypt `data` with this encryption algorithm.'''
33
 
        print(' * Decrypting: %s' % data)
34
 
        ddata = keys[self.source].decrypt(data[0])        
35
 
        print(' * Decrypted : %s' % ddata)
 
36
        ddata = keys[self.source].decrypt(data)
36
37
        return ddata
37
38
 
38
39
    def sign(self, data):