c++ - How do I decrypt a file with Crypto++ that was encrypted with C# -
I would like to decrypt the file which I previously encrypted with C # using the Tripledes crypto service provider Was there.
Here is my code to encrypt:
Private static zero encryption (Memory Stream Stream Toniccript) {// Encryption Algorithm Triple DES Algorithm = New Triple DESCRPSO Service Provider (); Byte [] desiv = new byte [8]; Byte [] desKey = new byte [16]; For (int i = 0; i
I have already found the crypto ++ library and have been able to create and link it. So I tried decrypting the file that was stored with encryption after C # (native) C ++ code:
FILE * fp; since a long time; Four * buf; If (_Wfopen_s (& amp; FP, _T ("MyTest.bin"), _T ("RB")) = 0) {return false; } Fseek (fp, 0, SEEK_END); // to finish len = ftell (fp); // Finally get the position (length) fseek (FP, 0, SEEK_SET); // begging Buf = (four *) maul (lane); // Molok Buffer Fred (Buff, Lane, 1, FP); // Read in Buffer Falcos (FP); BITI PIV [] = {0, 1, 2, 3, 4, 5, 6, 7}; BYTE pKey [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; CONST BITE * LPDITA = (CONST BITE *) (LPCTSR) buff; Size_t buffer size = Stellen (buff); Byte * Result = (Byte *) Molec (Buffer Size); CFB_FIPS_Mode & lt; DES_EDE2 & gt;: Decryption Decryption_DES_EDE2_CFB; Decryption_des_edE2_CFB.SetKeyWithIV (pKey, sizeof (PK), piv, size (piv)); Decryption_des_edE2_CFB.process string (result, LPDITA, buffer size);
This code will not decrypt properly. After decryption the result does not match the already encrypted plain text. Any thoughts about my code?
Can you encrypt and decrypt in c ++? Can you encrypt and decrypt c #?
Are you really using the same mode, padding and encrypt, decrypt sequence?
tdes.mode = ciphermode.ECB; Tdes.Padding = PaddingMode.PKCS7;
Comments
Post a Comment