PyNaCl change nonce size

276 Views Asked by At

I'm using pynacl for encryption and decryption using X25519 keys and ChaCha20-Poly1305 message encryption from a server that uses NSec to a python client that uses PyNaCl. I want to encrypt and decrypt using Box on the python side, which has a nonce size of 24. However, NSec's implementation uses nonces of 12 bytes.

Is there a way I can use nonces of 12 on the client side as well? Or is there a way to convert a 24 byte nonce to a 12 byte nonce and the other way around (this might be a long shot)?

Edit: if it's not possible to do this with PyNaCl, what would be a good library to used that does allow this (and creating X25519 and Ed25519 keys)?

Edit 2: clarified wording.

0

There are 0 best solutions below