0

I am currently working on pynacl library. The problem is I need to use the 45 byte shared key generated to be used to decrypt an AES-CBC encryption with an 25 byte IV. But the AES-CBC can only take 16/24/32 byte keys and 16 byte IV. Can anyone give me some suggestions on how to convert the 45 byte key to 32 bytes and the 25 byte IV to 16 bytes size.

user201537
  • 15
  • 2
  • 1
    The question is, where does a 45 byte key and a 25 byte IV come from? You should describe how you generate keys/IV of such length. You can't use both (directly) for AES. From your data the _actual_ key/IV can be derived of course, but here there are many ways/algorithms and this must be coordinated with the recipient side. – Topaco Dec 15 '20 at 07:07
  • The 45 byte is generated from X25519 key exchange implementation adn the IV is supplied externally to give a perspective. Actually I figured it out after posting this question. I found that the string length is different from its actual size. I was getting a 45 character long string but in actuality is still 32 bytes in size. So I figured that in-order to use the keys I need them in raw format. Thanks for dropping by though. – user201537 Dec 15 '20 at 09:16

0 Answers0