rasn_smime/
lib.rs

1#![doc = include_str!("../README.md")]
2#![no_std]
3
4pub mod ess;
5pub mod skd;
6
7use rasn::prelude::*;
8
9#[doc(inline)]
10pub use rasn_cms::{IssuerAndSerialNumber, RecipientKeyIdentifier, SubjectKeyIdentifier};
11
12/// S/MIME Capabilities provides a method of broadcasting the
13/// symmetric capabilities understood.  Algorithms SHOULD be ordered
14/// by preference and grouped by type.
15pub const CAPABILITIES: &Oid = Oid::ISO_MEMBER_BODY_US_RSADSI_PKCS9_CAPABILITIES;
16
17/// Encryption Key Preference provides a method of broadcasting the preferred
18/// encryption certificate.
19pub const ENCRYPTION_KEY_PREFERENCE: &Oid =
20    Oid::ISO_MEMBER_BODY_US_RSADSI_PKCS9_SMIME_AA_ENCRYPTION_KEY_PREFERENCE;
21
22/// Indicates the ability to receive messages with binary encoding inside the
23/// CMS wrapper. The attribute's value field is `None`.
24pub const PREFER_BINARY_INSIDE: &Oid =
25    Oid::ISO_MEMBER_BODY_US_RSADSI_PKCS9_SMIME_CAPABILITY_PREFER_BINARY_INSIDE;
26
27/// RC2 Key Length (number of bits)
28pub type CapabilitiesParametersForRc2Cbc = Integer;
29pub type Capabilities = SequenceOf<Capability>;
30
31#[derive(AsnType, Clone, Debug, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Hash)]
32pub struct Capability {
33    pub capability_id: ObjectIdentifier,
34    pub parameters: Option<Any>,
35}
36
37#[derive(AsnType, Clone, Debug, Decode, Encode, PartialEq, Eq, Hash)]
38#[rasn(choice)]
39pub enum EncryptionKeyPreference {
40    #[rasn(tag(0))]
41    IssuerAndSerialNumber(IssuerAndSerialNumber),
42    #[rasn(tag(1))]
43    ReceipentKeyId(RecipientKeyIdentifier),
44    #[rasn(tag(2))]
45    SubjectAltKeyIdentifier(SubjectKeyIdentifier),
46}