nacl-cryptography


How do I do encryption/decryption without generating keypairs again?

╄→гoц情女王★ 提交于 2020-01-04 05:14:22
问题 I have been working on a project myself and using this website's codes as a guide. Is there any way, I can put the generation of keys into 1 file and encryption/decryption into another. How do I define bob_box without having to generate another pair of keys? GEN.PY: import libnacl.public def genkeys(): bob = libnacl.public.SecretKey() alice = libnacl.public.SecretKey() bob_box = libnacl.public.Box(bob.sk, alice.pk) alice_box = libnacl.public.Box(alice.sk, bob.pk) genkeys() ENDEcrypt: import

Using libsodium in an android studio project

被刻印的时光 ゝ 提交于 2019-12-10 19:12:13
问题 I am trying to utilize the libsodium library in an android studio project. However, I am having trouble figuring out how to do this. I have the library downloaded from the libsodium website, but do not understand how to create the library files necessary for an android studio project. Any help would be greatly appreciated. I imagine that kalium (https://github.com/abstractj/kalium) would help me do this, but am slightly confused on how to incorporate that as well. 回答1: I know it's quite late,

How to generate a SHA256 hash of 32 bytes using nodejs (crypto) in order to avoid bad key size error thrown from tweetnacl.js?

梦想的初衷 提交于 2019-12-08 07:53:28
问题 I am using the crypto module of node.js to generate a SHA256 hash like this: const key = crypto.createHmac('sha256', data).digest('hex'); Now, tweetnacl throws the error: bad key size when the key is passed in the secretbox : nacl.secretbox(data, Rnonc, key); The parameters are converted into Uint8Array since the secretbox requires arguments to be Uint8Array. The error: bad key size is throw from here in tweetnacl since the crypto_secretbox_KEYBYTES is defined as 32 here. The problem is the

How to generate a SHA256 hash of 32 bytes using nodejs (crypto) in order to avoid bad key size error thrown from tweetnacl.js?

不羁岁月 提交于 2019-12-08 07:14:42
I am using the crypto module of node.js to generate a SHA256 hash like this: const key = crypto.createHmac('sha256', data).digest('hex'); Now, tweetnacl throws the error: bad key size when the key is passed in the secretbox : nacl.secretbox(data, Rnonc, key); The parameters are converted into Uint8Array since the secretbox requires arguments to be Uint8Array. The error: bad key size is throw from here in tweetnacl since the crypto_secretbox_KEYBYTES is defined as 32 here . The problem is the key returned from crypto is in not 32 bytes size. I have searched SO and relevant sites, but couldn't

Questions about the NaCL crypto library

送分小仙女□ 提交于 2019-12-03 07:48:38
问题 I was looking for libraries to implement an encryption system and was interested in using the NaCl: Networking and Cryptography library specifically the box function. Obviously, it uses symmetric encryption XSalsa20, Curve25519 for public-private cryptography and Poly1305 for authentication as the primitives for it. However, the documentation looks to be insufficient in the way the they've been used. For example, it mentions that to compute the key it uses the sender's private key and the

工具导航Map