ios - AES must have a fixed IV size of 16-bytes regardless key size -


hello using bbaes encrypt , decrypt code. getting error in line.

encrypteddata=[bb encrypteddatafromdata:[bb datafromstring:_secret encoding:bbaesdataencodingbase64] iv:[bb datafromstring:iv encoding:bbaesdataencodingbase64] key:hashkeydata options:bbaesencryptionoptionsincludeiv]; 

and error is

*** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'aes must have fixed iv size of 16-bytes regardless key size.' 

this how create hashkeydata

hashkeydata=[bb keybyhashingpassword:_key keysize:bbaessaltdefaultlength]; 

please me. thanks

you converting iv string iv data calling

[bb datafromstring:iv encoding:bbaesdataencodingbase64] 

this give more or less 16 bytes, depending on iv why getting exception.

the function should use use ivfromstring:. uses md5 hash create nsdata instance 16 bytes.

encrypteddata=[bb encrypteddatafromdata:[bb datafromstring:_secret encoding:bbaesdataencodingbase64] iv:[bb ivstring:iv] key:hashkeydata options:bbaesencryptionoptionsincludeiv]; 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -