Moves CTAP secrets to the key store (#617)
The PIN hash can be encrypted and decrypted, and CredRandom is part of the master secrets.
This commit is contained in:
@@ -70,6 +70,7 @@ use crate::api::crypto::hkdf256::Hkdf256;
|
||||
use crate::api::crypto::sha256::Sha256;
|
||||
use crate::api::crypto::HASH_SIZE;
|
||||
use crate::api::customization::Customization;
|
||||
use crate::api::key_store::KeyStore;
|
||||
use crate::api::rng::Rng;
|
||||
use crate::api::user_presence::{UserPresence, UserPresenceError};
|
||||
use crate::env::{EcdsaSk, Env, Hkdf, Sha};
|
||||
@@ -956,9 +957,9 @@ impl<E: Env> CtapState<E> {
|
||||
) -> Result<Secret<[u8; HASH_SIZE]>, Ctap2StatusCode> {
|
||||
let private_key_bytes = private_key.to_bytes();
|
||||
let salt = array_ref!(private_key_bytes, 0, 32);
|
||||
let key = storage::cred_random_secret(env, has_uv)?;
|
||||
let key = env.key_store().cred_random(has_uv)?;
|
||||
let mut output = Secret::default();
|
||||
Hkdf::<E>::hkdf_256(&key, salt, b"credRandom", &mut output);
|
||||
Hkdf::<E>::hkdf_256(&*key, salt, b"credRandom", &mut output);
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user