use std::collections::BTreeMap;
use crate::policy::CryptoPolicy;
pub struct CryptoPolicyDefault {}
impl CryptoPolicyDefault {
pub const DEFAULT_PBKDF_MSEC: u32 = 100;
const DEFAULT_PBKDF_ALG: &'static str = "argon2";
const DEFAULT_PBKDF_SALT_LEN: usize = 16;
const DEFAULT_CIPHER_ALG: &'static str = "aes-256-gcm-siv-det";
}
impl CryptoPolicy for CryptoPolicyDefault {
fn check_hash(&self, _alg: &str) -> Result<(), String> {
Ok(())
}
fn check_pbkdf(
&self,
_alg: &str,
_key_len: usize,
_password: &str,
_salt: &[u8],
_params: &BTreeMap<String, usize>,
) -> Result<(), String> {
Ok(())
}
fn check_cipher_alg_impl(&self, _alg: &str) -> Result<(), String> {
Ok(())
}
fn check_cipher(&self, _alg: &str, _key: &[u8], _iv: &[u8], _ad: &[u8]) -> Result<(), String> {
Ok(())
}
fn default_pbkdf_alg(&self) -> String {
Self::DEFAULT_PBKDF_ALG.to_string()
}
fn default_pbkdf_salt_length(&self) -> usize {
Self::DEFAULT_PBKDF_SALT_LEN
}
fn default_pbkdf_millis(&self) -> u32 {
Self::DEFAULT_PBKDF_MSEC
}
fn default_cipher_alg(&self) -> String {
Self::DEFAULT_CIPHER_ALG.to_string()
}
}