1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * NetHSM
 *
 * 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.
 *
 * The version of the OpenAPI document: v1
 * Contact: Nitrokey <info@nitrokey.com>
 * Generated by: https://openapi-generator.tech
 */

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KeyMechanism {
    #[serde(rename = "RSA_Decryption_RAW")]
    RsaDecryptionRaw,
    #[serde(rename = "RSA_Decryption_PKCS1")]
    RsaDecryptionPkcs1,
    #[serde(rename = "RSA_Decryption_OAEP_MD5")]
    RsaDecryptionOaepMd5,
    #[serde(rename = "RSA_Decryption_OAEP_SHA1")]
    RsaDecryptionOaepSha1,
    #[serde(rename = "RSA_Decryption_OAEP_SHA224")]
    RsaDecryptionOaepSha224,
    #[serde(rename = "RSA_Decryption_OAEP_SHA256")]
    RsaDecryptionOaepSha256,
    #[serde(rename = "RSA_Decryption_OAEP_SHA384")]
    RsaDecryptionOaepSha384,
    #[serde(rename = "RSA_Decryption_OAEP_SHA512")]
    RsaDecryptionOaepSha512,
    #[serde(rename = "RSA_Signature_PKCS1")]
    RsaSignaturePkcs1,
    #[serde(rename = "RSA_Signature_PSS_MD5")]
    RsaSignaturePssMd5,
    #[serde(rename = "RSA_Signature_PSS_SHA1")]
    RsaSignaturePssSha1,
    #[serde(rename = "RSA_Signature_PSS_SHA224")]
    RsaSignaturePssSha224,
    #[serde(rename = "RSA_Signature_PSS_SHA256")]
    RsaSignaturePssSha256,
    #[serde(rename = "RSA_Signature_PSS_SHA384")]
    RsaSignaturePssSha384,
    #[serde(rename = "RSA_Signature_PSS_SHA512")]
    RsaSignaturePssSha512,
    #[serde(rename = "EdDSA_Signature")]
    EdDsaSignature,
    #[serde(rename = "ECDSA_Signature")]
    EcdsaSignature,
    #[serde(rename = "AES_Encryption_CBC")]
    AesEncryptionCbc,
    #[serde(rename = "AES_Decryption_CBC")]
    AesDecryptionCbc,
}

impl ToString for KeyMechanism {
    fn to_string(&self) -> String {
        match self {
            Self::RsaDecryptionRaw => String::from("RSA_Decryption_RAW"),
            Self::RsaDecryptionPkcs1 => String::from("RSA_Decryption_PKCS1"),
            Self::RsaDecryptionOaepMd5 => String::from("RSA_Decryption_OAEP_MD5"),
            Self::RsaDecryptionOaepSha1 => String::from("RSA_Decryption_OAEP_SHA1"),
            Self::RsaDecryptionOaepSha224 => String::from("RSA_Decryption_OAEP_SHA224"),
            Self::RsaDecryptionOaepSha256 => String::from("RSA_Decryption_OAEP_SHA256"),
            Self::RsaDecryptionOaepSha384 => String::from("RSA_Decryption_OAEP_SHA384"),
            Self::RsaDecryptionOaepSha512 => String::from("RSA_Decryption_OAEP_SHA512"),
            Self::RsaSignaturePkcs1 => String::from("RSA_Signature_PKCS1"),
            Self::RsaSignaturePssMd5 => String::from("RSA_Signature_PSS_MD5"),
            Self::RsaSignaturePssSha1 => String::from("RSA_Signature_PSS_SHA1"),
            Self::RsaSignaturePssSha224 => String::from("RSA_Signature_PSS_SHA224"),
            Self::RsaSignaturePssSha256 => String::from("RSA_Signature_PSS_SHA256"),
            Self::RsaSignaturePssSha384 => String::from("RSA_Signature_PSS_SHA384"),
            Self::RsaSignaturePssSha512 => String::from("RSA_Signature_PSS_SHA512"),
            Self::EdDsaSignature => String::from("EdDSA_Signature"),
            Self::EcdsaSignature => String::from("ECDSA_Signature"),
            Self::AesEncryptionCbc => String::from("AES_Encryption_CBC"),
            Self::AesDecryptionCbc => String::from("AES_Decryption_CBC"),
        }
    }
}

impl Default for KeyMechanism {
    fn default() -> KeyMechanism {
        Self::RsaDecryptionRaw
    }
}