You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using crypto.encrypt("AES128", text, key) API to encrypt our data. But whenever i pass key whose size is more than 32 bytes/char it say invalid key.
Is there anyway i can pass longer keys ? or this is a bug ?
The text was updated successfully, but these errors were encountered:
kpushpad
changed the title
kpushpad
key length issue in crypto.encrypt API
Oct 31, 2014
I am using crypto.encrypt("AES128", text, key) API to encrypt our data.
But whenever i pass key whose size is more than 32 bytes/char it say
invalid key.
Is there anyway i can pass longer keys ? or this is a bug ?
This is not a bug, it's a feature (of most ciphers) - the key has a certain
fixed length - in your case 128 bits. Keys shorter than that get padded,
but obviously you can't use longer keys.
The standard aproach is to first hash the password with a 128 bit (160,
256, depending on cipher/configuration) hash and use that as a key.
I am using crypto.encrypt("AES128", text, key) API to encrypt our data. But whenever i pass key whose size is more than 32 bytes/char it say invalid key.
Is there anyway i can pass longer keys ? or this is a bug ?
The text was updated successfully, but these errors were encountered: