encryption - Ecryption Issues -


I'm trying to store some encrypted information in the cookie. I'm generating a small string (about 64 characters), generates a key using the generated alerts (), and I am trying for AES or Blowfish encryption.

I have tried to use default UUEncoding, Base64, and Hex parameters in encod () and decode () functions.

With AES, I get an error

An error occurred while trying to encrypt or decrypt my input string: com.rsa.jsafe.crypto.dr: Unpadding: invalid pad byte ..

With bloepish, I get an error

An error occurred while encrypting your input string or Trying to decrypt: The last block was not properly formed

< P> What am I doing wrong?

A 64-bit block size, which is 8 bytes, is 128 bits of block size, which is 16 bytes .

Block size means that it can only do blocks of that size. So some 7,6,5,4,3,2,1 bytes can not bytes the block size of 8 bytes.

If you have the desired bits or bytes (8 and 16 bytes) here, you must do pad to reach some 8/16 byte long blocks (padding in English Means that you have to attach unused bits / bytes - sometimes the content determined by the protocol / algorithm, sometimes the material does not matter) unless you have the size of the required size.)

Both errors occur ABB complains about padding. So my garbage is that you are not passing the correct size (length) of data for encryption / decryption algorithm.

  • One exact number of block size (= in case you have to padding in this case)
  • An arbitrary size of the data (= You do not have to do padding - but then you get the error Why started?)
  • Any chance you accidentally encrypted your UU / Base 64 / HEX encoding before ?

    You should:

    • Encrypt first,
    • then UU / Base 64 / hex encoding,
    • then data send out.

    Obviously, when the reverse data is received, the sequence:

    • First UU / base 64 / hex decode,
    • then decrypt ,
    • Then use the data.

    Comments

    Popular posts from this blog

    oracle - The fastest way to check if some records in a database table? -

    php - multilevel menu with multilevel array -

    jQuery UI: Datepicker month format -