Hi Jeff,
 

This worked. Thanks !
  



std::string encrypt_aes(std::string message, SecByteBlock key, SecByteBlock 
iv) {
try {
cout <<" in encrypt aes " <<endl;
AlgorithmParameters params = MakeParameters(Name::FeedbackSize(), 1 /*16*8 
-bits*/)
(Name::IV(), ConstByteArrayParameter(iv));
CFB_Mode<AES>::Encryption e;
std::string cipher;
e.SetKey(key, key.size(), params);
StringSource ss(message, true, new StreamTransformationFilter(e, new 
StringSink(cipher)));
cout << " returning cipher " << endl;
return cipher;
}
catch (CryptoPP::Exception e) {
std::cerr << e.what() << std::endl;
return "";
}
}

AlgorithmParameters params = MakeParameters(Name::FeedbackSize(), 1 
/*8-bits*/) (Name::IV(), ConstByteArrayParameter(iv));
CFB_Mode< AES >::Encryption enc; enc.SetKey( key, key.size(), params ); // 
CFB mode must not use padding. Specifying // a scheme will result in an 
exception StringSource ss1( plain, true, new StreamTransformationFilter( 
enc, new StringSink( cipher ) ) // StreamTransformationFilter ); // 
StringSource





On Thursday, April 27, 2023 at 12:15:56 PM UTC-4 Jeffrey Walton wrote:

> On Thu, Apr 27, 2023 at 11:43 AM Dwight Kulkarni <[email protected]> 
> wrote:
> >
> > Today I am trying to resolve an AES incompatibility with Python. I am 
> using CFB Mode. I use the same base64 key and iv on both and I printed out 
> the bytes and they are the same.
> >
> > I load in the same key/iv into both of them. When I print out the bytes 
> they are different.
> > [...]
>
> https://www.cryptopp.com/wiki/CFB_Mode#Feedback_Size
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/957ddc75-b593-4c86-a80d-28e7316a9c04n%40googlegroups.com.

Reply via email to