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
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

use clap;
use serde::{Deserialize, Serialize};

pub mod ecdsa;
pub mod rsa;

#[derive(clap::ValueEnum, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum KeyEncoding {
    /// When saving, Pem means Pkcs8Pem.
    #[serde(alias = "pem")]
    Pem,
    /// When saving, Der means Pkcs8Der.
    #[serde(alias = "der")]
    Der,
    /// When saving, Pkcs1 means Pkcs1Pem.
    #[serde(alias = "pkcs1")]
    Pkcs1,
    /// When saving, Pkcs8 means Pkcs8Pem.
    #[serde(alias = "pkcs8")]
    Pkcs8,
    /// Pcks1 encoding in a PEM container.
    #[serde(alias = "pkcs1-pem")]
    Pkcs1Pem,
    /// Pcks8 encoding in a PEM container.
    #[serde(alias = "pkcs8-pem")]
    Pkcs8Pem,
    /// Pcks1 encoding in a DER container.
    #[serde(alias = "pkcs1-der")]
    Pkcs1Der,
    /// Pcks8 encoding in a DER container.
    #[serde(alias = "pkcs8-der")]
    Pkcs8Der,
}