#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SignatureAlgorithm {
EdDsa,
Es256,
}
impl SignatureAlgorithm {
#[must_use]
pub const fn codepoint(self) -> i64 {
match self {
Self::EdDsa => -8,
Self::Es256 => -7,
}
}
#[must_use]
pub const fn from_codepoint(alg: i64) -> Option<Self> {
match alg {
-8 => Some(Self::EdDsa),
-7 => Some(Self::Es256),
_ => None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum KeyAgreementAlgorithm {
EcdhEsHkdf256,
}
impl KeyAgreementAlgorithm {
#[must_use]
pub const fn codepoint(self) -> i64 {
match self {
Self::EcdhEsHkdf256 => -25,
}
}
#[must_use]
pub const fn from_codepoint(alg: i64) -> Option<Self> {
match alg {
-25 => Some(Self::EcdhEsHkdf256),
_ => None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ContentAlgorithm {
A256Gcm,
ChaCha20Poly1305,
}
impl ContentAlgorithm {
#[must_use]
pub const fn codepoint(self) -> i64 {
match self {
Self::A256Gcm => 3,
Self::ChaCha20Poly1305 => 24,
}
}
#[must_use]
pub const fn from_codepoint(alg: i64) -> Option<Self> {
match alg {
3 => Some(Self::A256Gcm),
24 => Some(Self::ChaCha20Poly1305),
_ => None,
}
}
#[must_use]
pub const fn key_len(self) -> usize {
32
}
}