Add a new trait based Nid setup
This commit is contained in:
parent
356d4a0420
commit
49db4c84df
|
|
@ -24,6 +24,7 @@ pub mod crypto;
|
||||||
pub mod dh;
|
pub mod dh;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod nid;
|
pub mod nid;
|
||||||
|
pub mod nid2;
|
||||||
pub mod ssl;
|
pub mod ssl;
|
||||||
pub mod version;
|
pub mod version;
|
||||||
pub mod x509;
|
pub mod x509;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
use libc::c_int;
|
||||||
|
|
||||||
|
pub trait Nid {
|
||||||
|
fn nid() -> c_int;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! make_nids {
|
||||||
|
($($name:ident $id:expr,)+) => {
|
||||||
|
$(
|
||||||
|
pub struct $name;
|
||||||
|
|
||||||
|
impl Nid for $name {
|
||||||
|
fn nid() -> c_int {
|
||||||
|
$id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
make_nids! {
|
||||||
|
Undef 0,
|
||||||
|
Algorithm 38,
|
||||||
|
Rsadsi 1,
|
||||||
|
Pkcs 2,
|
||||||
|
Md2 3,
|
||||||
|
Md5 4,
|
||||||
|
Rc4 5,
|
||||||
|
RsaEncryption 6,
|
||||||
|
Md2WithRsaEncryption 7,
|
||||||
|
Md5WithRsaEncryption 8,
|
||||||
|
PbeWithMd2AndDesCbc 9,
|
||||||
|
PbeWithMd5AndDesCbc 10,
|
||||||
|
X500 11,
|
||||||
|
X509 12,
|
||||||
|
CommonName 13,
|
||||||
|
CountryName 14,
|
||||||
|
LocalityName 15,
|
||||||
|
StateOrProvinceName 16,
|
||||||
|
OrganizationName 17,
|
||||||
|
OrganizationalUnitName 18,
|
||||||
|
Rsa 19,
|
||||||
|
Pkcs7 20,
|
||||||
|
Pkcs7Data 21,
|
||||||
|
Pkcs7Signed 22,
|
||||||
|
Pkcs7Enveloped 23,
|
||||||
|
Pkcs7SignedAndEnveloped 24,
|
||||||
|
Pkcs7Digest 25,
|
||||||
|
Pkcs7Encrypted 26,
|
||||||
|
Pkcs3 27,
|
||||||
|
DhKeyAgreement 28,
|
||||||
|
DesEcb 29,
|
||||||
|
DesCfb64 30,
|
||||||
|
DesCbc 31,
|
||||||
|
DesEde 32,
|
||||||
|
DesEde3 33,
|
||||||
|
IdeaCbc 34,
|
||||||
|
IdeaCfb64 35,
|
||||||
|
IdeaEcb 36,
|
||||||
|
Rc2Cbc 37,
|
||||||
|
Rc2Ecb 38,
|
||||||
|
Rc2Cfb64 39,
|
||||||
|
Rc2Ofb64 40,
|
||||||
|
Sha 41,
|
||||||
|
ShaWithRsaEncryption 42,
|
||||||
|
DesEdeCbc 43,
|
||||||
|
DesEde3Cbc 44,
|
||||||
|
DesOfb64 45,
|
||||||
|
IdeaOfb64 46,
|
||||||
|
Pkcs9 47,
|
||||||
|
Pkcs9EmailAddress 48,
|
||||||
|
Pkcs9UnstructuredName 49,
|
||||||
|
Pkcs9ContentType 50,
|
||||||
|
Pkcs9MessageDigest 51,
|
||||||
|
Pkcs9SigningTime 52,
|
||||||
|
Pkcs9CounterSignature 53,
|
||||||
|
Pkcs9ChallengePassword 54,
|
||||||
|
Pkcs9UnstructuredAddress 55,
|
||||||
|
Pkcs99ExtCertAttributes 56,
|
||||||
|
Netscape 57,
|
||||||
|
NetscapeCertExtension 58,
|
||||||
|
NetscapeDataType 59,
|
||||||
|
DesEdeCfb64 60,
|
||||||
|
DesEde3Cfb64 61,
|
||||||
|
DesEdeOfb64 62,
|
||||||
|
DesEde3Ofb64 63,
|
||||||
|
Sha1 64,
|
||||||
|
Sha1WithRsaEncryption 65,
|
||||||
|
DsaWithSha 66,
|
||||||
|
Dsa2 67,
|
||||||
|
PbeWithSha1AndRc2Cbc 68,
|
||||||
|
IdPbkdf2 69,
|
||||||
|
DsaWithSha12 70,
|
||||||
|
NetscapeCertType 71,
|
||||||
|
NetscapeBaseUrl 72,
|
||||||
|
NetscapeRevocationUrl 73,
|
||||||
|
NetscapeCaRevocationUrl 74,
|
||||||
|
NetscapeRenewalUrl 75,
|
||||||
|
NetscapeCaPolicyUrl 76,
|
||||||
|
NetscapSslServerName 77,
|
||||||
|
NetscapeComment 78,
|
||||||
|
NetscapeCertSequence 79,
|
||||||
|
DesxCbc 80,
|
||||||
|
IdCe 81,
|
||||||
|
SubjectKeyIdentifier 82,
|
||||||
|
KeyUsage 83,
|
||||||
|
PrivateKeyUsagePeriod 84,
|
||||||
|
SubjectAltName 85,
|
||||||
|
IssuerAltName 86,
|
||||||
|
BasicConstraints 87,
|
||||||
|
CrlNumber 88,
|
||||||
|
CertificatePolicies 89,
|
||||||
|
AuthorityKeyIdentifier 90,
|
||||||
|
BfCbc 91,
|
||||||
|
BfEcb 92,
|
||||||
|
BfCbc64 93,
|
||||||
|
BfOfb64 94,
|
||||||
|
Mdc2 95,
|
||||||
|
Mdc2WithRsa 96,
|
||||||
|
Rc440 97,
|
||||||
|
Rc240Cbc 98,
|
||||||
|
GivenName 99,
|
||||||
|
Surname 100,
|
||||||
|
Initials 101,
|
||||||
|
UniqueIdentifier 102,
|
||||||
|
CrlDistributionPoints 103,
|
||||||
|
Md5WithRsa 104,
|
||||||
|
SerialNumber 105,
|
||||||
|
Title 106,
|
||||||
|
Description 107,
|
||||||
|
Cast5Cbc 108,
|
||||||
|
Cast5Ecb 109,
|
||||||
|
Cast5Cfb64 110,
|
||||||
|
Cast5Ofb64 111,
|
||||||
|
PbeWithMd5AndCast5Cbc 112,
|
||||||
|
DsaWithSha1 113,
|
||||||
|
Md5Sha1 114,
|
||||||
|
Sha1WithRsa 115,
|
||||||
|
Dsa 116,
|
||||||
|
Ripemd160 117,
|
||||||
|
// No 118
|
||||||
|
Ripemd160WithRsa 119,
|
||||||
|
Rc5Cbc 120,
|
||||||
|
Rc5Ecb 121,
|
||||||
|
Rc5Cfb64 122,
|
||||||
|
Rc5Ofb64 123,
|
||||||
|
RleCompression 124,
|
||||||
|
ZlibCompression 125,
|
||||||
|
ExtKeyUsage 126,
|
||||||
|
IdPkix 127,
|
||||||
|
IdKp 128,
|
||||||
|
ServerAuth 129,
|
||||||
|
ClientAuth 130,
|
||||||
|
CodeSign 131,
|
||||||
|
EmailProtect 132,
|
||||||
|
TimeStamp 133,
|
||||||
|
MsCodeInd 134,
|
||||||
|
MsCodeCom 135,
|
||||||
|
MsCtlSign 136,
|
||||||
|
MsSgc 137,
|
||||||
|
MsEfs 138,
|
||||||
|
NsSgc 138,
|
||||||
|
DeltaCrl 140,
|
||||||
|
CrlReason 141,
|
||||||
|
InvalidityDate 142,
|
||||||
|
Sxnet 143,
|
||||||
|
PbeWithSha1And128BitRc4 144,
|
||||||
|
PbeWithSha1And40BitRc4 145,
|
||||||
|
PbeWithSha1And3KeyTripleDesCbc 146,
|
||||||
|
PbeWithSha1And2KeyTripleDesCbc 147,
|
||||||
|
Pb3WithSha1And128BitRc2Cbc 148,
|
||||||
|
PbeWithSha1And40BigRc2Cbc 149,
|
||||||
|
KeyBag 150,
|
||||||
|
Pkcs8ShroudedKeyBag 151,
|
||||||
|
CertBag 152,
|
||||||
|
CrlBag 153,
|
||||||
|
SecretBag 154,
|
||||||
|
SafeContentsBag 155,
|
||||||
|
FriendlyName 156,
|
||||||
|
LocalKeyId 157,
|
||||||
|
X509Certificate 158,
|
||||||
|
SdsiCertificate 159,
|
||||||
|
X509Crl 160,
|
||||||
|
Pbes2 161,
|
||||||
|
Pbmac1 162,
|
||||||
|
HmacWithSha1 163,
|
||||||
|
IdQtCps 164,
|
||||||
|
IdQtUnotice 165,
|
||||||
|
Rc264Cbc 166,
|
||||||
|
SmimeCapabilities 167,
|
||||||
|
PbeWithMd2AndRc2Cbc 168,
|
||||||
|
PbeWithMd5AndRc2Dbc 169,
|
||||||
|
PbeWithSha1AndDesCbc 170,
|
||||||
|
MsExtReq 171,
|
||||||
|
ExtReq 172,
|
||||||
|
Name 173,
|
||||||
|
DnQualifier 174,
|
||||||
|
IdPe 175,
|
||||||
|
IdAd 176,
|
||||||
|
InfoAccess 177,
|
||||||
|
AdOcsp 178,
|
||||||
|
AdCaIssuers 179,
|
||||||
|
OcspSign 180,
|
||||||
|
|
||||||
|
UserId 458,
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue