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)]
12pub enum KeyMechanism {
13    #[serde(rename = "RSA_Decryption_RAW")]
14    RsaDecryptionRaw,
15    #[serde(rename = "RSA_Decryption_PKCS1")]
16    RsaDecryptionPkcs1,
17    #[serde(rename = "RSA_Decryption_OAEP_MD5")]
18    RsaDecryptionOaepMd5,
19    #[serde(rename = "RSA_Decryption_OAEP_SHA1")]
20    RsaDecryptionOaepSha1,
21    #[serde(rename = "RSA_Decryption_OAEP_SHA224")]
22    RsaDecryptionOaepSha224,
23    #[serde(rename = "RSA_Decryption_OAEP_SHA256")]
24    RsaDecryptionOaepSha256,
25    #[serde(rename = "RSA_Decryption_OAEP_SHA384")]
26    RsaDecryptionOaepSha384,
27    #[serde(rename = "RSA_Decryption_OAEP_SHA512")]
28    RsaDecryptionOaepSha512,
29    #[serde(rename = "RSA_Signature_PKCS1")]
30    RsaSignaturePkcs1,
31    #[serde(rename = "RSA_Signature_PSS_MD5")]
32    RsaSignaturePssMd5,
33    #[serde(rename = "RSA_Signature_PSS_SHA1")]
34    RsaSignaturePssSha1,
35    #[serde(rename = "RSA_Signature_PSS_SHA224")]
36    RsaSignaturePssSha224,
37    #[serde(rename = "RSA_Signature_PSS_SHA256")]
38    RsaSignaturePssSha256,
39    #[serde(rename = "RSA_Signature_PSS_SHA384")]
40    RsaSignaturePssSha384,
41    #[serde(rename = "RSA_Signature_PSS_SHA512")]
42    RsaSignaturePssSha512,
43    #[serde(rename = "EdDSA_Signature")]
44    EdDsaSignature,
45    #[serde(rename = "ECDSA_Signature")]
46    EcdsaSignature,
47    #[serde(rename = "AES_Encryption_CBC")]
48    AesEncryptionCbc,
49    #[serde(rename = "AES_Decryption_CBC")]
50    AesDecryptionCbc,
51}
52
53impl std::fmt::Display for KeyMechanism {
54    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55        write!(
56            f,
57            "{}",
58            match self {
59                Self::RsaDecryptionRaw => "RSA_Decryption_RAW",
60                Self::RsaDecryptionPkcs1 => "RSA_Decryption_PKCS1",
61                Self::RsaDecryptionOaepMd5 => "RSA_Decryption_OAEP_MD5",
62                Self::RsaDecryptionOaepSha1 => "RSA_Decryption_OAEP_SHA1",
63                Self::RsaDecryptionOaepSha224 => "RSA_Decryption_OAEP_SHA224",
64                Self::RsaDecryptionOaepSha256 => "RSA_Decryption_OAEP_SHA256",
65                Self::RsaDecryptionOaepSha384 => "RSA_Decryption_OAEP_SHA384",
66                Self::RsaDecryptionOaepSha512 => "RSA_Decryption_OAEP_SHA512",
67                Self::RsaSignaturePkcs1 => "RSA_Signature_PKCS1",
68                Self::RsaSignaturePssMd5 => "RSA_Signature_PSS_MD5",
69                Self::RsaSignaturePssSha1 => "RSA_Signature_PSS_SHA1",
70                Self::RsaSignaturePssSha224 => "RSA_Signature_PSS_SHA224",
71                Self::RsaSignaturePssSha256 => "RSA_Signature_PSS_SHA256",
72                Self::RsaSignaturePssSha384 => "RSA_Signature_PSS_SHA384",
73                Self::RsaSignaturePssSha512 => "RSA_Signature_PSS_SHA512",
74                Self::EdDsaSignature => "EdDSA_Signature",
75                Self::EcdsaSignature => "ECDSA_Signature",
76                Self::AesEncryptionCbc => "AES_Encryption_CBC",
77                Self::AesDecryptionCbc => "AES_Decryption_CBC",
78            }
79        )
80    }
81}
82
83impl Default for KeyMechanism {
84    fn default() -> KeyMechanism {
85        Self::RsaDecryptionRaw
86    }
87}