#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum HashAlgorithm {
Md5,
Sha256,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum HmacAlgorithm {
Sha1,
Sha256,
}
impl HmacAlgorithm {
#[must_use]
pub const fn output_len(self) -> usize {
match self {
Self::Sha1 => 20,
Self::Sha256 => 32,
}
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum AeadAlgorithm {
Aes128Gcm,
Aes256Gcm,
Aes128Ccm,
Aes128Ccm8,
ChaCha20Poly1305,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum StreamCipherAlgorithm {
Aes128Ctr,
Aes256Ctr,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BlockCipherAlgorithm {
Aes128,
Aes256,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CbcAlgorithm {
Aes256Cbc,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum KeyExchangeAlgorithm {
P256,
P384,
X25519,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SignatureScheme {
Ed25519,
EcdsaP256Sha256,
EcdsaP384Sha384,
RsaPkcs1Sha1,
RsaPkcs1Sha256,
RsaPkcs1Sha384,
RsaPkcs1Sha512,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum PublicKeyEncoding {
SubjectPublicKeyInfoDer,
EcUncompressedPoint,
Ed25519Raw,
RsaPkcs1Der,
}
#[derive(Debug, Clone, Copy)]
pub struct PublicKey<'a> {
pub encoding: PublicKeyEncoding,
pub bytes: &'a [u8],
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CryptoAlgorithm {
Hash(HashAlgorithm),
Hmac(HmacAlgorithm),
Aead(AeadAlgorithm),
StreamCipher(StreamCipherAlgorithm),
BlockCipher(BlockCipherAlgorithm),
Cbc(CbcAlgorithm),
KeyExchange(KeyExchangeAlgorithm),
Signature(SignatureScheme),
SigningKeyGeneration(SignatureScheme),
SigningKeyImport(SignatureScheme),
}