# Questions tagged [key-derivation]

In cryptography, a key derivation function (or KDF) derives one or more secret keys from a secret value such as a master key or other known information such as a password or passphrase using a pseudo-random function. Keyed cryptographic hash functions are popular examples of pseudo-random functions used for key derivation.

389 questions
1answer
188 views

### What's the reasoning behind the design of the TLS 1.2 PRF?

TLS 1.2 defines a PRF-like construction $P_{hash} : \{0,1\}^* \times \{0,1\}^* \rightarrow \{0,1\}^l$ for key derivation, etc. To quote the spec: We define a data expansion function, ...
1answer
1k views

### Why is it a bad idea to use a UTF-8 derived symmetric key?

Given a cryptographically secure series of octets, it is often useful to display this information or store it in a database in a textual format such as hexadecimal. Why would it be incorrect to take ...
1answer
484 views

### Single public key for NaCL signing and encryption?

Bob wants to use NaCL (specifically the Python NaCL library) to both a) sign some publically available plaintext for anybody to authenticate as being written by Bob and b) encrypt some other secret ...
0answers
365 views

### Bitwise method of generating r for RSA-KEM

It seems that RSA-KEM has a very troublesome method of generating the secret $r$. It seems that the random value needs to be in the range $0 \le r \le {n - 1}$. Now most cryptographic environments ...
2answers
130 views

### Does a key derivation function always generate an even distribution of bits in the resulting key?

I am a student of crypto. During our study course, we went into the AES-128 algorithm. All the examples given used an initial key k, 128 bits and we only briefly touched on the key derivation of ...
1answer
3k views

### Key derivation using the main AES encryption key and some plain text?

I am using AES 128 bit encryption in java. I have an encryption key and 10 digit plain text. I want to derive a key for HMAC using the AES encryption key and the 10 digit plain text. This plain text ...
1answer
113 views

### Building multiple keys from the same input using a KDF [duplicate]

Let's say I have a single secret with high entropy, S, for the entire application. I want to generate keys K1, K2 for 2 ...
1answer
62 views

### Can shuffling plaintext produce a useable key?

If I 'shuffle' the characters in a long text, is there some number of shuffles that will produce apparent randomness approaching a cryptographically secure random number generator? A chapter in a ...
1answer
72 views

### Could a key derivation function be used to encrypt data with a weaker key?

To allow the key to be more easily remembered. Example: To encrypt a hard drive without having a remember a key with 128 bits of entropy. From what I find they seem mostly used to hash passwords so ...
0answers
340 views

### NIST SP800-108 KDF modes comparison

According to NIST SP800-108, there are three modes that can build KDF from PRF: counter mode, feedback mode and double-pipeline iteration mode. Assume that the same PRF and input distribution are used,...
2answers
911 views

### PHP AES 256 CBC faster than AES 128 CBC? Or am I doing something wrong?

for last couple of days I'm learning a bit about encrypting data in PHP, as I need a good encryption/decryption function for storing user's passwords in DB. I use ...
4answers
12k views

### Why does the FBI ask Apple for help to decrypt an iPhone?

The current debate of the FBI trying to get Apple to assist in decrypting an iPhone made me wonder: Normally, upon turning on an iPhone, everything is decrypted using a 4-digit pin (or actually, a ...
0answers
185 views

### Need help with PKCS#12 3 key triple des key expansion

I am trying to decrypt PKCS8-Shrouded Key Bag inside a PKCS#12 pfx file. The oid for the encrypted data is PbeWithSHAAnd3-KeyTripleDES CBC. Iteration count and salt has been provided within the pfx ...
1answer
115 views

### Cycling hashing in PBKDF's and their limitations in strength?

I hope this question isn't too similar to one that's already been asked. I also want to point out I know part the answer already, AFAIK: I just want some expert input on this. Let's model a hash that ...
1answer
385 views

### Faster alternative to HKDF

HKDF is used in one of my projects to derive separate keys from a common master key. But profiling has shown it to be the performance bottleneck under certain circumstances. Is there any faster ...
1answer
276 views

### Would it be better to use HKDF or SCrypt for deriving a child key?

Okay so I'm trying to derive a child public key from an EC public key. I've come up with a couple ideas and now I'd like to know which is more secure. Mp: The master key pair, this includes a ...
2answers
1k views

### On AES, is a true random string enough for a key?

The string (32 ASCII characters) is entered by a human, and considered truly random. Should a key derive from this string, or it is secure to use this string as a key directly? In other words, does ...
1answer
77 views

### NMaster key from n secret key

I have to derive master key from N secret key. With the help of master key, i can collect all the secret keys which is used to derive master key. key1, key2,..keyN ==> single master key and single ...
1answer
353 views

### Big block cipher as memory-hard function

I'm wondering, if something like block cipher with big block size is a good memory-hard function? All memory-hard key derivation functions I've seen look more complex than that, which made me ...
1answer
152 views

### Memory hardness of key derivation function through XOR-ring multiple matrix values

For theoretical purposes in order to enhance my own understanding, and NOT in order to create my own cryptography, I am asking a question about the memory-hardness of a key derivation function ...
1answer
145 views

### Can Pseudorandom values be used as secure keys?

I want to derive $n$ keys from a master key. I pick a master key $mk$ and use pseudo-random function (PRF) to generate $n$ pseudo-random values, $v_i=PRF(mk,i)$ where $1\leq i \leq n$. Next, I use ...
1answer
20k views

### Password hashing security of argon2 versus bcrypt/PBKDF2?

I wonder if it can be approximated how much of a security margin the new argon2 hash, winner of the password hashing competition, can give over bcrypt or PBKDF2, for an attacker using large GPU ...
1answer
267 views

### Key Derivation Function (KDF): Can a key derived from KDF be considered as a secure key?

Consider a case where we have a master key MS that is used in pseudo-random function to generate a set of pseudo-random values. Then we use key derivation function to derive a key from each of pseudo-...
3answers
379 views

### Memory hard key derivation (password hash) using AES encryption

I am restricted on a certain environment involving PHP and am currently unable to implement new memory hard hashes such as scrypt (and I am not trying to compete with the likes of scrypt). My ...
1answer
88 views

### Key derivation function in theory & practice

I am implementing a cryptographic protocol and I'd like to generate a set of seeds using a seed for a pseudo-random function. The reason is that I can pass on only one seed and it can be used to ...
1answer
105 views

### How is a group element converted into a key?

I've only just started research on cryptography so I apologize if this is a basic question or I'm getting terms confused. I'm researching braid group cryptography and currently looking at the Anshel-...
1answer
476 views

### Is it true that 7zip doesn't use any salt with its KDF?

This issue claims that 7zip does not use any salt with its key derivation function: https://github.com/magnumripper/JohnTheRipper/issues/1679 If that's true, wouldn't that mean you can crack multiple ...
1answer
508 views

### Private and Public Keys

I have a very basic understanding of encryption and the encapsulation process, but for the life of me I can't grasp how public keys and private keys work, how they're made, and how they're exchanged. ...
0answers
273 views

### ECDH security when no KDF is used

Let's suppose our device performs ECDH with a fixed, unknown, private key $prv$. It accepts as input any point $Q$ lying in the proper subgroup of the proper ellipict curve, then computes: $P = prv*Q$...
3answers
465 views

### Which method to generate one time password?

I'm looking for a concrete algorithm to generate one time passwords. The situation is as follows: Alice and Bob exchanged a passphrase over a secure channel in the beginning. They want to ...
1answer
2k views

### Public Key Encryption using ECDHE and AES-GCM

Using a text book example, Alice and Bob want to communicate securely using encrypted messages over an insecure channel (the Internet). Alice and Bob have decided to use ECDH (using ephemeral keys ...
1answer
311 views

### AES-256 mode with per-block-key being a SHA-256 of SHA-256 of secret key, random public salt and block number. What's amiss?

Please criticize the (homebrew?) mode described below; to point out a single major defect/uncertainty or the link to (the analysis of) an equivalent construction is quite enough. Assume the ...
1answer
202 views

### Hash functions vs. keyed hash functions in the context of private key generation

I'm designing a key distribution mechanism and have thought of using a securely generated/acquired private key as a seed for a sequence of private keys to be distributed to a number of users using a ...
0answers
95 views

### How to derive a key from an existing AES key?

Currently, the code I am staring at uses the CKM_EXTRACT_KEY_FROM_KEY mechanism. That has been disabled in our hardware module, so I need a different mechanism to ...
2answers
174 views

### How to generate backup key for PBKD functions?

I would like to encrypt some files using AES, Ill derive key from password using some standard PBKD function and use that as AES encryption key. My question is, if user forgets the main password, ...
1answer
263 views

### Is this scheme to derive multiple keys secure?

I need a cryptographic scheme to generate a deterministic chain of private keys that look random to outside observer but can always be reconstructed from a single root key, also: Neither private ...
3answers
2k views

### How is a public/private key pair generated from a Diffe-Hellman key exchange?

I very well understand the DH key exchange. But what is the public key and private key at the end of the exchange. For example: Alice and Bob agree to use a modulus $p = 23$ and base $g = 5$ (which ...
1answer
285 views

### Practical benefit of using a KDF?

I see that KDFs should be used in systems that rely on PSKs, but what practical benefit does it provide? For instance, suppose the system relies on a shared secret for AES encryption and decryption. ...
1answer
458 views

### Obtain 384 bits from a 256bit MasterSecret

I'm currently implementing, with crypto++, and AES tranmsission system, whose key is based on a previous ...
0answers
137 views

### How does FileVault2 Recovery actually work?

I'm a crypto-enthusiast but no expert at all, that'll explain why i didn't understand. Also please consider english isn't my native language :) I am about to enable FileVault2 FDE on the new macbook ...
2answers
3k views

### How to derive a symmetric key from ECDH shared secret?

I am trying to implement the internal primitives of ECDH. Currently I'm able to multiply the receiver's public EC point with the sender's private key to arrive at the shared EC point. Next step is to ...
0answers
64 views

### Concepts for realization in applied cryptography [closed]

I'm a computer science student (not a mathematican) and I'm gonna to write a master degree diploma on applied cryptography. Specifically, I'd like to create a realization of some cryptographic stuff ...
2answers
206 views

### Is entropy being lost when the hash of a secret has a specific format?

Bitcoin's mini private key format works by brute forcing random data to produce a secret so that when appending ? and then hashing with sha256 it will produce a ...
2answers
961 views

### Mathematical formula for switching the key for OTP?

Instead of generating the random key for the one time pad cipher over and over again, is there a mathematical formula that allows you to switch the key to a new key? The new key must be as random and ...
2answers
361 views

### Memory hard password based key derivation functions?

How are memory hard functions designed for the purpose of password based key derivation? To protect against a brute force attack from a parallel machine. What design could work well with Skein? The ...
1answer
103 views

### Software interface for KDF and PBKDF?

I'm working on an implementation of Krawczyk and Eronen HKDF from RFC 5869. From Krawczyk's original paper, he identifies four inputs to a KDF in Cryptographic Extraction and Key Derivation: The HKDF ...
1answer
972 views

### Derive cipher IV and cipher Key using PBKDF2 with random salt?

It is said that cipher IV does not have to be secret and the only secret component of the encryption scheme should be a cipher key. Question: is it safe to generate IV using PBKDF2 function, which ...
2answers
454 views

### SHA256_HMAC for deriving session keys using a counter

I need to generate some session keys from a master key that was generated from an ECDH key exchange. The master key is 256 bits and I need 256 bit sessions keys. Is it safe to use SHA256_HMAC with ...
1answer
177 views

### What's wrong with an iterative (with counter) hashed salted KDF?

It seems like the brain-dead simplest KDF would have a key-stretching structure that is not substantially different from $\text{hash}(S | P | S | P |\dots|S|P)$, where $S$ is a salt and $P$ is a ...
1answer
406 views

### Differences between HMAC and HKDF in a specific case

I want to use a key derivation function to derive a key to another one. I think HKDF is the easiest solution in my case. The following picture gives a clear definition of it : http://webee.technion....