Skip to main content

tightbeam/crypto/
mod.rs

1mod utils;
2
3/// Macro to define OID wrapper types with `AssociatedOid` implementation.
4///
5/// This reduces boilerplate for creating simple marker types that implement
6/// the `AssociatedOid` trait.
7#[macro_export]
8macro_rules! define_oid_wrapper {
9	// Variant with doc comment and inline OID string
10	($(#[$meta:meta])* $name:ident, $oid_str:literal) => {
11		$(#[$meta])*
12		pub struct $name;
13		$(#[$meta])*
14		impl $crate::der::oid::AssociatedOid for $name {
15			const OID: $crate::asn1::ObjectIdentifier =
16				$crate::asn1::ObjectIdentifier::new_unwrap($oid_str);
17		}
18	};
19	// Variant with doc comment and OID constant reference
20	($(#[$meta:meta])* $name:ident, $oid_const:path) => {
21		$(#[$meta])*
22		pub struct $name;
23		$(#[$meta])*
24		impl $crate::der::oid::AssociatedOid for $name {
25			const OID: $crate::asn1::ObjectIdentifier = $oid_const;
26		}
27	};
28}
29
30pub mod key;
31pub mod policy;
32pub mod profiles;
33pub mod secret;
34
35#[cfg(feature = "aead")]
36pub mod aead;
37#[cfg(feature = "ecdh")]
38pub mod curves;
39#[cfg(feature = "ecies")]
40pub mod ecies;
41#[cfg(feature = "digest")]
42pub mod hash;
43#[cfg(feature = "kdf")]
44pub mod kdf;
45#[cfg(feature = "kem")]
46pub mod kem;
47#[cfg(feature = "signature")]
48pub mod sign;
49#[cfg(feature = "x509")]
50pub mod x509;
51
52// Re-exports
53pub use crypto_common as common;
54
55#[cfg(feature = "secp256k1")]
56pub const ECDSA_PUBKEY_SIZE: usize = 33;
57#[cfg(feature = "secp256k1")]
58pub const ECDSA_SECRET_SIZE: usize = 32;