nethsm_sdk_rs/models/
key_mechanism.rs

1/*
2 * NetHSM
3 *
4 * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: Nitrokey <info@nitrokey.com>
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
12#[non_exhaustive]
13pub enum KeyMechanism {
14    #[serde(rename = "RSA_Decryption_RAW")]
15    RsaDecryptionRaw,
16    #[serde(rename = "RSA_Decryption_PKCS1")]
17    RsaDecryptionPkcs1,
18    #[serde(rename = "RSA_Decryption_OAEP_MD5")]
19    RsaDecryptionOaepMd5,
20    #[serde(rename = "RSA_Decryption_OAEP_SHA1")]
21    RsaDecryptionOaepSha1,
22    #[serde(rename = "RSA_Decryption_OAEP_SHA224")]
23    RsaDecryptionOaepSha224,
24    #[serde(rename = "RSA_Decryption_OAEP_SHA256")]
25    RsaDecryptionOaepSha256,
26    #[serde(rename = "RSA_Decryption_OAEP_SHA384")]
27    RsaDecryptionOaepSha384,
28    #[serde(rename = "RSA_Decryption_OAEP_SHA512")]
29    RsaDecryptionOaepSha512,
30    #[serde(rename = "RSA_Signature_PKCS1")]
31    RsaSignaturePkcs1,
32    #[serde(rename = "RSA_Signature_PSS_MD5")]
33    RsaSignaturePssMd5,
34    #[serde(rename = "RSA_Signature_PSS_SHA1")]
35    RsaSignaturePssSha1,
36    #[serde(rename = "RSA_Signature_PSS_SHA224")]
37    RsaSignaturePssSha224,
38    #[serde(rename = "RSA_Signature_PSS_SHA256")]
39    RsaSignaturePssSha256,
40    #[serde(rename = "RSA_Signature_PSS_SHA384")]
41    RsaSignaturePssSha384,
42    #[serde(rename = "RSA_Signature_PSS_SHA512")]
43    RsaSignaturePssSha512,
44    #[serde(rename = "EdDSA_Signature")]
45    EdDsaSignature,
46    #[serde(rename = "ECDSA_Signature")]
47    EcdsaSignature,
48    #[serde(rename = "BIP340_Signature")]
49    Bip340Signature,
50    #[serde(rename = "AES_Encryption_CBC")]
51    AesEncryptionCbc,
52    #[serde(rename = "AES_Decryption_CBC")]
53    AesDecryptionCbc,
54}
55
56impl std::fmt::Display for KeyMechanism {
57    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
58        write!(
59            f,
60            "{}",
61            match self {
62                Self::RsaDecryptionRaw => "RSA_Decryption_RAW",
63                Self::RsaDecryptionPkcs1 => "RSA_Decryption_PKCS1",
64                Self::RsaDecryptionOaepMd5 => "RSA_Decryption_OAEP_MD5",
65                Self::RsaDecryptionOaepSha1 => "RSA_Decryption_OAEP_SHA1",
66                Self::RsaDecryptionOaepSha224 => "RSA_Decryption_OAEP_SHA224",
67                Self::RsaDecryptionOaepSha256 => "RSA_Decryption_OAEP_SHA256",
68                Self::RsaDecryptionOaepSha384 => "RSA_Decryption_OAEP_SHA384",
69                Self::RsaDecryptionOaepSha512 => "RSA_Decryption_OAEP_SHA512",
70                Self::RsaSignaturePkcs1 => "RSA_Signature_PKCS1",
71                Self::RsaSignaturePssMd5 => "RSA_Signature_PSS_MD5",
72                Self::RsaSignaturePssSha1 => "RSA_Signature_PSS_SHA1",
73                Self::RsaSignaturePssSha224 => "RSA_Signature_PSS_SHA224",
74                Self::RsaSignaturePssSha256 => "RSA_Signature_PSS_SHA256",
75                Self::RsaSignaturePssSha384 => "RSA_Signature_PSS_SHA384",
76                Self::RsaSignaturePssSha512 => "RSA_Signature_PSS_SHA512",
77                Self::EdDsaSignature => "EdDSA_Signature",
78                Self::EcdsaSignature => "ECDSA_Signature",
79                Self::Bip340Signature => "BIP340_Signature",
80                Self::AesEncryptionCbc => "AES_Encryption_CBC",
81                Self::AesDecryptionCbc => "AES_Decryption_CBC",
82            }
83        )
84    }
85}
86
87impl Default for KeyMechanism {
88    fn default() -> KeyMechanism {
89        Self::RsaDecryptionRaw
90    }
91}