0

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.

Yuri van Geffen
  • 853
  • 1
  • 7
  • 21
  • What is an "NSec powered server"? If possible could you at least provide some links to the API calls you are making for those people that don't have your setup present and won't be able to replicate the issue (i.e. me)? – Maarten Bodewes Dec 27 '19 at 21:43
  • I changed the wording. I meant server using NSec (https://nsec.rocks/). I eventually ended up switching out PyNaCl for another library (https://cryptography.io/en/latest/), but an answer might still be relevant for others. – Yuri van Geffen Jan 08 '20 at 10:34

0 Answers0