--- euca2ools/euca2ools/__init__.py 2010-09-03 16:18:03 +0000 +++ euca2ools/euca2ools/__init__.py 2010-09-20 13:42:56 +0000 @@ -711,10 +711,13 @@ print 'Encrypting image' enc_file = '%s.part' % file.replace('.tar.gz', '') - key = hex(BN.rand(16 * 8))[2:34].replace('L', 'c') + # get 17 bytes of randomness with top bit a '1'. + # convert to a hex string like '0x<34 hex chars>L' + # then take the last 32 of the hex digits, giving 32 random hex chars + key = hex(BN.rand(17 * 8,top=0))[4:36] if self.debug: print 'Key: %s' % key - iv = hex(BN.rand(16 * 8))[2:34].replace('L', 'c') + iv = hex(BN.rand(17 * 8,top=0))[4:36] if self.debug: print 'IV: %s' % iv