libcrypto.EVP_CipherUpdate.argtypes=(c_void_p,c_char_p,POINTER(c_int),c_char_p,c_int)
libcrypto.EVP_get_cipherbyname.restype=c_void_p
libcrypto.EVP_get_cipherbyname.argtypes=(c_char_p,)
-
+libcrypto.EVP_CIPHER_CTX_set_key_length.argtypes=(c_void_p,c_int)
c=cipher.new("bf-ofb",encryptkey,iv=iv)
ciphertext=c.update(data)+c.finish()
decryptkey=encryptkey[0:5]+encryptkey[5:]
- d=cipher.new("bf-ofb",decryptkey,iv=iv)
+ d=cipher.new("bf-ofb",decryptkey,encrypt=False,iv=iv)
deciph=d.update(ciphertext)+d.finish()
self.assertEqual(deciph,data)
if __name__ == '__main__':