.net parsed numerical is 24, and prompt error according to the rules of the AES IV IV vector is a 16-bit, Java is 16
CodePudding user response:
Encoding. The Default, it is to point to the current system Settings "is the Default character set Encoding" for Encoding. UTF8 try againCodePudding user response:
Public static string Decode (string cipherText)
{
Var toEncryptArray=the Convert. FromBase64String (cipherText);
Var rm=new System. Security. Cryptography. RijndaelManaged ()
{
Key=the Convert. FromBase64String (" GFqjnlbHe46v40/jEZO88Q=="),
Mode=CipherMode. The ECB,
Padding=PaddingMode. None
};
Var cTransform=rm. CreateDecryptor ();
Var resultArray=cTransform. TransformFinalBlock (toEncryptArray, 0, toEncryptArray. Length);
ResultArray=FixBytes_Decode (resultArray);
Return. Encoding UTF8. Get string (resultArray);
}
Private static byte [] FixBytes_Decode (byte [] d_Bytes)
{
Var temp=d_Bytes. ToList ();
Int remove_Count=temp. LastOrDefault ();
Temp=temp. Take (temp. Count - remove_Count). ToList ();
Return temp. ToArray ();
}
Under the reference!
CodePudding user response:
Problems found, the server directly to decrypt the key operation, the. Net must first be converted to Base64, in decoding, otherwise the decoding error, lead to IV vector byte array into 24, result in abnormal or encryption failure,For the have good way to solve this problem:
CodePudding user response:
The key value in the Java in the picture is the content to. Net and Java different little elder brother encryption resultsCodePudding user response:
Grammar is a bigger difference