use serde::{Deserialize, Serialize};
mod ec;
mod oct;
mod okp;
mod rsa;
pub use self::ec::{Ec, EcCurves};
pub use self::oct::Oct;
pub use self::okp::{Okp, OkpCurves};
pub use self::rsa::{Rsa, RsaOptional, RsaOtherPrimes, RsaPrivate};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE", tag = "kty")]
#[non_exhaustive]
pub enum Key {
Ec(Ec),
Rsa(Rsa),
#[serde(rename = "oct")]
Oct(Oct),
Okp(Okp),
}
impl From<Ec> for Key {
#[inline(always)]
fn from(key: Ec) -> Self {
Self::Ec(key)
}
}
impl From<Rsa> for Key {
#[inline(always)]
fn from(key: Rsa) -> Self {
Self::Rsa(key)
}
}
impl From<Oct> for Key {
#[inline(always)]
fn from(key: Oct) -> Self {
Self::Oct(key)
}
}
impl From<Okp> for Key {
#[inline(always)]
fn from(key: Okp) -> Self {
Self::Okp(key)
}
}