.net - Encoding.Unicode.GetString error when resolving encryption Byte() -
have been trying encrypt xml file string may transfer on service. transmission server server using symetric key compiled code.
i have been using aes sample msdn , converting byte arry , string so:
' encrypt string array of bytes. dim encrypted byte() = crypto.encryptstring(original, _key, _iv) dim encrypstr string = encoding.unicode.getstring(encrypted) '''' >>> transmit... dim posttrans byte() = encoding.unicode.getbytes(encrypstr) ' decrypt bytes string. dim roundtrip string = crypto.decryptstring(posttrans, _key, _iv)
without middle 2 line encrypt/decrypt works fine, middle 2 lines included either recieve badly formed xml document cannot parsed or "padding invalid , cannot removed" error.
is not method string encryption? works without converting byte() string ad back.
do not use encoding.getstring(), not work. use tobase64()
thanks henk holterman answer.
Comments
Post a Comment