Questions tagged [nonce]

A "nonce" is an arbitrary number or string used only once within the context of a specific cryptographic scheme. Nonces are used e.g. in authentication protocols to prevent replay attacks, as well as in stream ciphers (including CTR mode) to avoid keystream reuse.

Filter by
Sorted by
Tagged with
1
vote
0answers
42 views

Implement deterministic authenticated encryption using libsodium

Note: this is my first question on stack exchange, let me know if you miss some details to answer and I will edit the question accordingly Context I'm willing to create a git encryption tool (...
1
vote
1answer
421 views

Is it safe to use many nonces for XChaCha20?

I have a very simple question. Since XChaCha20 nonces are 192-bit, there's technically no limitation to the max number of message encrypted, since the chances of two random nonces being the same are ...
1
vote
2answers
51 views

Is nonce-less Encrypt-then-HMAC as secure as poly1305

While reading https://crypto.stackexchange.com/a/88732/87450 I noticed that it suggests encrypt-then-HMAC as a defense for partition attacks. However as far as I know unlike poly1305, HMAC does not ...
0
votes
0answers
26 views

How Mac-then-encrypt provide security in nonce-misuse setting?

From this, it is clear that Encrypt-then-Mac provides more complete security than Mac-then-Encrypt but some schemes use Mac-then-encrypt to provide nonce-misuse resistance such as SIV (AES-GCM-SIV, ...
1
vote
0answers
59 views

Forgery of the Carter-Wegman MAC

Consider the nonce-based Carter-Wegman MAC which works on key space $K=\{0,1\}^n \times \{0,1\}^n,$ message space $M=\{0,1\}^{mn}$, nonce space $N=\{0,1\}^n$ and the tag space $T=\{0,1\}^n$ as follows:...
0
votes
0answers
32 views

Best way to derive a MAC key without a salt

It's best to use separate keys for encryption and the MAC. Most implementations tend to derive a larger key and split it in two (e.g. scrypt with an output of 32 + 64 = 96). Alternatively, you can ...
3
votes
1answer
63 views

What are the implications of allowing a zero-length GCM nonce?

NIST SP800-38D section 5.2.1.1 is clear that empty nonces are not allowed with GCM, but without explaining the reasoning. My assumption was this is simply because the probability of error (encrypting ...
0
votes
0answers
28 views

Recommended length for a nonce in hashed-based authentication

Considering the following variation of the SKID3 protocol (1) $A \rightarrow B: r_A$ (2) $B \rightarrow A: r_B || \operatorname{MAC}(r_B||r_A||A)$ (3) $A \rightarrow B: \operatorname{MAC}(r_B||r_A||B)$...
2
votes
2answers
94 views

Can I use ChaCha20-Poly1305 as my KDF?

I have two devices that use a PSK. One is embedded and extremely resource confined. I'm already using ChaCha20-Poly1305 so it would be "free" to reuse this. There is no transport encryption ...
2
votes
1answer
87 views

AES256 CTR nonce generation

I am following a wiki diagram for CTR mode of operation in AES256. The documentation states that for it to work you need a random nonce with 8 bytes and then a counter of 8 bytes. So I guess you can ...
0
votes
1answer
41 views

Can a nonce be used to steganographically hide a message?

If a standard encryption scheme involves a nonce, as most do, can the nonce be used to hide another small message? That is, the nonce (rather than being randomly generated) is a hidden message XORed ...
0
votes
2answers
142 views

Encrypt a big file in blocks with AES-GCM: how many nonce do we need?

I need to encrypt big files using AES-GCM, potentially 10 GB or more. For memory (RAM) reasons, I need to processs them by blocks (let's say 16 MB), rather than doing ...
1
vote
1answer
94 views

Can we encrypt part of the XChaCha/XSalsa nonce?

The xChaCha cipher detailed here extends the nonce 192bits and works as follows (from the link): Pass the key and the first 16 bytes of the 24-byte nonce to HChaCha20 to obtain the subkey. Use the ...
0
votes
0answers
69 views

Cryptanalytic tests for biased nonces

In the paper Biased Nonce Sense: Lattice Attacks against Weak ECDSA Signatures in Cryptocurrencies on section 5.2 Cryptanalytic tests for biased nonces, one of test is: Select two signatures at ...
1
vote
1answer
91 views

Using a nonce as a salt for key derivation

I'm currently playing a bit with PyNaCl (python binding to libsodium) and I want to use the secretbox for symmetric encryption between two parties, which means they both must know the (in my case ...
0
votes
0answers
45 views

Which of the following is/are true about nonces/timestamps?

a. A nonce may or may not be predictable. b. Use of timestamps requires fewer numbers of messages compared to nonce-only authentication protocols. c. Server keeps track of nonce it has used in the ...
0
votes
1answer
54 views

Why is SKEYSEED derived using the nonce as a key?

In IKEv2, SKEYSEED, which is used to as a seed for generating the rest of the keys, is generated as SKEYSEED = prf(Ni | Nr, g^ir)...
1
vote
1answer
60 views

What is encrypted with the key to give the keystream in CTR mode exactly?

I'm learning how CTR mode and there is something I have trouble understanding. If I understood correctly, two components are encrypted with the key, a nonce and a counter concatenated, and it looks ...
3
votes
0answers
72 views

Use of nonces in the SIGMA protocol and not in C(2e, 2s) of NIST SP800-56a?

While reading the paper on the SIGMA: the ‘SIGn-and-MAc’ Approach to Authenticated Diffie-Hellman and its Use in the IKE Protocols (Krawczyk,2003), I noticed that in the "full-fledge" ...
9
votes
0answers
120 views

Are there any weak nonce-misuse resistant encryption scheme?

Nonce-misuse resistance seems to have two standard notions: The stronger notion: this reveals nothing unless the exact same nonce is used to encrypt the exact same message twice. In this case, the ...
0
votes
0answers
54 views

Authentication using a nonce

For an authentication problem imagine the following scenario with two devices: 1 server 1 client. The client starts a conversation with the server and sends him his public key. All public keys in ...
2
votes
1answer
223 views

Why is it secure to reuse key and nonce in ChaCha20-Poly1305 AEAD construction?

While looking at the ChaCha20 and Poly1305 AEAD construction as defined by RFC 8439, more precisely its use of the key and the nonce, I came up with the questions below. Maybe someone with some in-...
1
vote
1answer
38 views

What should an identifer in the client-server model?

I am fairly new to cryptography and I am trying to understand this picture here. I have some questions regarding this picture. What should be an identifer for a side? For example, in the picture, it ...
3
votes
1answer
95 views

Is there an increased risk of nonce reuse when using GCM with a nonce more than 96 bits?

GCM is designed to use a 96-bit nonce, which can be generated either randomly or deterministically. If you use a nonce that isn't 96 bits then it is padded and hashed with GHASH to create a ...
0
votes
0answers
39 views

salsa20 (Key, Nonce) repeatable?

in Salsa20, the Key is 128 or 256 bits, the Nonce is 64 bits. the pair (k,r) should never be reused. Does it means, if the key is fixed, the encryption can only run 2^64 times? if the key is not fixed,...
1
vote
1answer
84 views

Nonce of AES-GCM generated by Counters

i am trying to generate the nonce for AES-GCM. I know people usually generate it by Counters and LFSRs. I am confused about the meaning of Counters. Is that means Counter (CTR)? Why it can generate ...
1
vote
2answers
192 views

Repeating nonce in CTR mode

Can anybody explain in detail why repeating nonce is dangerous in CTR mode? Two cases to explain When plain text is repeated for each nonce. When plain text is unique for each nonce .
2
votes
1answer
264 views

Is it safe to reuse the same nonce for decryption an indefinite amount of times in this context?

I'm creating a password management application and I'm considering using the following procedure to keep passwords safe: Asking the user for raw_password, for ...
2
votes
1answer
92 views

If ChaCha20 is being used just as a CSPRNG, is nonce needed?

I'm planning to use ChaCha20 just as a CSPRNG. Key is random (taken from strong initial entropy source) and will be constantly replaced via DJB's fast key-erasure scheme. What should I use as the ...
4
votes
2answers
1k views

Is it safe to convert a 256-bit nonce into a 192-bit nonce by SHA-256ing and then truncating it?

I'd expect a 192-bit nonce derived from a 256-bit nonce by computing the SHA-256 hash and then truncating it to 24 bytes to behave like an approximately uniformly randomly generated 192-bit nonce and ...
3
votes
2answers
271 views

Size of IV in AES-GCM according to RFC 4106

RFC 4106 specifies about nonce. It contains a salt of size 4 octets and an iv of size 8 octets. Further, RFC specifies that salt is assigned at the beginning of the security associations which is ...
1
vote
1answer
400 views

How to generate a nonce for ChaCha20 Poly1305?

I am using a self implementation of ChaCha20 with Poly1305. Since the nonce is only 96 bits it cannot be chosen at random. Can anyone suggest an efficient method to generate nonce from the key ?
0
votes
2answers
1k views

What is the use of a nonce in public-key encryption if it's meant to be shared?

I'm using PHP. The guys over at paragonie have made encryption easy for the PHP eco-system. Now, on my computer, Alice, when I ...
2
votes
1answer
198 views

ChaCha20-Poly1305: Can my salt/pass for a KDF also be the nonce?

I have a PSK. I don't want to use it directly. I want to pass a "salt"/password into a KDF and get a new key for authenticated encryption with ChaCha20-Poly1305 . I need to give the other side the ...
-1
votes
1answer
67 views

How to implement nonce for hashing a 6 digit sensitive number with hmac with its secret key

I have to pass a 6 digit number which has to be kept very secret through a unsecured netwok. I am thinking to hash it using hmac and a secret key which only me and the reciever knows So the code ...
1
vote
0answers
103 views

Break an encryption made with XOR of a key and a known Nonce

My questions is general, but in my case regards the Kerberos protocol and the communication between the client first message and the KDC. Is there some problem in encrypting using a: (secret key XOR ...
2
votes
2answers
2k views

Why does a nonce prevent a replay attack?

I have a question about a cryptographic nonce. I understand the use of a nonce, however there is one particular part that I don't understand. Please consider the picture below. I don't really ...
0
votes
1answer
145 views

What's the utility of the last two messages of Needham Schroeder Symmetric key protocol

The protocol works like this But I can't understand what's the utility of message 4 and 5, what do they protect from? They do not protect from replay attack if Ks gets compromised because B won't be ...
1
vote
0answers
93 views

Why does a “never-repeating” nonce limit a key to safely encrypt only a single block?

This questions comes from a section outlined in RFC 5297 on SIV-AES. The paragraph in particular outlines the idea of a never repeating nonce vs an "almost always" non-repeating nonce. If the nonce ...
1
vote
1answer
283 views

Chacha20 internal counter/position and nonce

I have to encrypt the communications between two devices. I was planning on using a timestamp(in seconds) and the serial number as the nonce. I know its impossible for me to send more than 100 ...
0
votes
1answer
66 views

Safely store data before moving to air-gapped machine

This is related to an earlier question, Is it possible to use an algorithm to generate an OTP? I have two machines: A, and B. A is connected to the internet and files are uploaded regularly. B is ...
1
vote
1answer
299 views

Authenticated Encryption mode & AEAD

I'm studying Authenticated encryption with Associated Data (AEAD). My questions are About AE - I heard that when it comes to Encrypt-then-MAC, if an attacker forges the ciphertext then he gets the ...
0
votes
2answers
222 views

XORing a nonce with a ciphertext vs XORing a nonce with plain text and then encrypt

Consider a situation where a symmetric key encryption (such as AES) is used to encrypt the plain text. Moreover, a nonce is used to ensure that old communication cannot be used to perform a replay ...
0
votes
1answer
104 views

Using same key and nonce for different field of the same document

I have some fields, similar to NAME, SURNAME, EMAIL, ADDRESS... I'm using NaCl for symmetric encryption. Is bad If I Encrypt every field with the same key and nonce? They are encrypted and stored ...
0
votes
1answer
296 views

AES-CCM replay attack and nonce

My wireless sensor nodes and gateway application use timestamps as nonces and guarantee that different messages use different nonces so that security is not compromised. If the gateway does not ...
2
votes
1answer
1k views

ChaCha20: is this a potentially safe way of using nonce derived from private key if the key/nonce pair is never reused, for a given plaintext?

Note: I realize in ChaCha20 the nonce should be random and unique each time follow certain constraints but am trying to determine whether there could be a safe way to use it just once if other ...
2
votes
1answer
2k views

AES-GCM cipher - Nonce vs IV

I am using a Python library called PyCryptodome, which offers the following API for AES-GCM ciphers: https://pycryptodome.readthedocs.io/en/latest/src/cipher/aes.html As you see, IV is not ...
1
vote
0answers
46 views

Why does 3-way authentication need the 3rd nonce to be stored?

In the following 3-way authentication protocol: A -> B: $N_a$ || B || Signature_KprivA B -> A: $N_a+1$ || $N_b$ || A || Signature_KprivB A -> B: $N_b+1$ || Signature_KprivA ($N_a$ and $N_b$ are ...
3
votes
3answers
747 views

How to prevent accidental nonce reuse with AEAD cipher

I'm trying to correctly implement ChaCha20-Poly1305 in my node.js app (...crypto is hard). I understand that the cipher requires a unique key/nonce pair for each message or the security breaks down. ...
0
votes
0answers
96 views

Digital Signature Password verification

I currently have this TOFU protocol: First connection: Client generates salt and inputs a password Client saves salt Client hashes password with argon2 and salt Client generates Ed25519 keys Client ...