53 votes
Accepted

What are requirements for HMAC secret key?

I've added my answer here as I feel the existing ones don't directly address your question enough for my liking. Let's look at RFC 4868 (regarding IPSec, however it covers the HMAC-SHA256 function you ...
user avatar
37 votes

Best Practice: ”separate ssh-key per host and user“ vs. ”one ssh-key for all hosts“

I think this question can be considered from two different angles: security and convenience. When we create a SSH key pair, we are asked for providing a passphrase to add a more layer to protect the ...
user avatar
  • 471
36 votes
Accepted

JSON Web Tokens - How to securely store the key?

The reality is if other processes can access your process memory or features of your virtual machine, the game is probably over as you're already compromised. If a process has access at this level, it ...
user avatar
  • 3,242
26 votes
Accepted

What exactly is a subkey?

This post by user rjh from 2008 in the enigmail forum answers it well: Originally in PGP 2.6, back in the early 90s, you had just one keypair and it was used for both encryption and signing. The ...
user avatar
  • 1,606
26 votes
Accepted

Why does an encryption key derived from your lock screen password give you stronger protection (in Android 11)?

In all cases, the encryption key is chosen at random by the device (your mobile phone). When biometrics are used to unlock the phone, they are checked by a mostly secure module (a TEE, in your case ...
user avatar
  • 9,957
26 votes
Accepted

Is "Math.random" the same as "crypto.getRandomValues" (JavaScript security)

See MDN: Crypto.getRandomValues(), where it reads: The Crypto.getRandomValues() method lets you get cryptographically strong random values. (emphasis mine) In contrast, see MDN: Math.random(), where ...
user avatar
  • 19.6k
24 votes
Accepted

TPM or OpenSSL for key generation?

The difference between using some hardware backed key store (i.e. TPM, HSM, smartcard ...) and a "pure software" solution like openssl genrsa is not so much about the security of the key ...
user avatar
23 votes

What are requirements for HMAC secret key?

According to RFC 7518 - JSON Web Algorithms (JWA): A key of the same size as the hash output (for instance, 256 bits for "HS256") or larger MUST be used with this algorithm. (This ...
user avatar
23 votes
Accepted

ssh-keygen: What is the passphrase for?

$ man ssh-keygen [...] It is possible to specify a passphrase when generating the key; that passphrase will be used to encrypt the private part of this file using 128-bit AES. So this passphrase just ...
user avatar
  • 31.8k
21 votes

Calculate time taken to break AES key

One of my favourite gems on encryption is from Bruce Schneier in his book Applied Cryptography. One of the consequences of the second law of thermodynamics is that a certain amount of energy is ...
user avatar
  • 701
21 votes
Accepted

Do you need more than 128-bit entropy?

128 bits of entropy are enough. The whole and only point of considering entropy is to make sure that the system can resist brute force attacks: the space of possible values must be so large that any ...
user avatar
20 votes

Should I hash a password if it is randomly generated

The point of hashing passwords is that if the attacker can gain access to your password file (by breaking into your server, stealing backup media, hacking your hosting provider, etc.) he/she still can'...
user avatar
  • 321
17 votes

Is there any reason someone wouldn't use a longer key?

Each bit of a key increases the difficulty of a brute-force attack exponentially but there is a trade-off. Adding more bits to the key will negatively effect the speed of encryption/decryption. The ...
user avatar
17 votes

What exactly is a subkey?

Subkeys Subkey packets are defined in RFC 4880, OpenPGP, 5.5 Key Material Packet. They're only distinguished by another packet ID, and require a binding signature to be actually useful (see below). A ...
user avatar
  • 23.2k
16 votes
Accepted

Calculate time taken to break AES key

Well, using simple math: If checking one key takes 1000 clock cycles, and the computer has 2,000,000,000 cycles per second, it checks 2 million keys per second. The best case is that the first key you ...
user avatar
  • 7,183
13 votes
Accepted

ECC Public Key length differs from bit representation

An elliptic curve is defined over a finite field of size q for some integer q. Each curve element is a point and has two coordinates X and Y, which are curve elements. The "size" of the ...
user avatar
13 votes

Is it possible to make a more secure random number generator algorithm by XORing two or more less secure random number algorithms?

I would not recommend combining random number generators in this way without having some underlying theory to support your case. A simple way to illustrate the issues is to consider the behavior of ...
user avatar
12 votes

What are requirements for HMAC secret key?

The RFC 2104 defining HMAC functions answers this question: The key for HMAC can be of any length (keys longer than B bytes are first hashed using H). However, less than L bytes is strongly ...
user avatar
12 votes

Is "Math.random" the same as "crypto.getRandomValues" (JavaScript security)

Your friend is correct; always use Crypto.getRandomValues instead of Math.random for anything related to security. Math.random is designed for statistical simulations; and the numbers it produces ...
user avatar
  • 33.5k
11 votes

SSH key-type, rsa, dsa, ecdsa, are there easy answers for which to choose when?

Use RSA. Not for security reasons, but for compatibility reasons. I don't recommend using DSA keys. As of OpenSSH 7.0, SSH no longer supports DSA keys by default. As the release notes for OpenSSH ...
user avatar
  • 98.3k
10 votes
Accepted

Alternatives to HTML's deprecated <keygen> for client certs?

In this post in the chromium forum there are alternatives mentioned Within the browser space, alternatives exist such as: Use the device's native management capabilities if an enterprise use case. ...
user avatar
  • 1,682
10 votes
Accepted

What's the best length for randomly generated passwords? (Security vs. compatibility)

If your passwords are n characters randomly drawn, with equal probability, from a set of 95 characters (which is about all the ASCII printable characters minus space), then each character gives you ...
user avatar
10 votes
Accepted

Rotating encryption keys - how does it work?

In layman's terms, rotating an encryption key implies: Generate new key(s) Re-encrypt all data that was encrypted using the old key, using new key(s) Delete old encrypted data and old encrypted key ...
user avatar
  • 71.7k
9 votes
Accepted

Diffie-Hellman key exchange

With big numbers, Diffie-Hellman looks like this: we work modulo a big prime p, and we start with a conventional big integer g (in the 2..p-2 range). Each integer modulo p represents an achieved ...
user avatar
9 votes
Accepted

What is the exact meaning of "Keying material"?

What is the exact meaning of “Keying material”? Keying material is a more general and fancy term for "secret keys of (unspecified) format, length and amount", where the "unspecified&...
user avatar
  • 9,480
9 votes

Rotating encryption keys - how does it work?

The meaning of rotate is going to depend on your data owner’s security policy. It may help to understand how keys are often managed in a key-management system using a key lifecycle state chart. A ...
user avatar
  • 33.5k
9 votes

What research suggests that user's mouse movements are (not) sufficiently unpredictable for secret key generation?

I do not believe there are any research papers that describe the unpredictability of the neuromuscular system in the context of computer security and at the sample rates that are relevant, so I can't ...
user avatar
  • 63.8k
9 votes
Accepted

Preparing to change over to new GPG-key - what to do with my old ones?

Thanks for the comment response, that helped a little bit. These are general recommendations, YMMV and you can always tweak them to your own needs. This is just a good place to start and things to ...
user avatar
  • 791
8 votes

Should I hash a password if it is randomly generated

There are two levels: You need some hashing as a second line of defence, so that what you store on the server (I call "server" the system which does the authentication by verifying a given password) ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible