Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cOID Struct Reference

#include <cOID.h>

Static Public Member Functions

static const char *GRAYCALL FindAttrShortName (const cMemBlock &oid)
 
static const cOIDDefBase *GRAYCALL FindOIDForAttr (const char *name, StrLen_t name_len)
 
static bool GRAYCALL FindX509_EXT (const cMemBlock &oid, OUT X509_EXT_t &ext_type)
 Translate an X.509 extension OID into local values. More...
 
static bool GRAYCALL FindPrivateKeyType (const cMemBlock &oid, SSL_Key_TYPE &eKeyType)
 Translate PublicKeyAlgorithm OID into SSL_Key_TYPE. More...
 
static const cOIDDefBase *GRAYCALL FindOIDForPrivateKeyType (SSL_Key_TYPE eKeyType)
 Translate SSL_Key_TYPE into PublicKeyAlgorithm OID. More...
 
static bool GRAYCALL FindECPGroupId (const cMemBlock &oid, ECPGroup_TYPE &eECPGroupId)
 Translate NamedCurve OID into an EC group identifier. More...
 
static const cOIDDefBase *GRAYCALL FindOIDForECPGroupId (ECPGroup_TYPE eECPGroupId)
 Translate EC group identifier into NamedCurve OID. More...
 
static bool GRAYCALL ReadSigAlg (const cASNBuf &oid, OUT cKeySigAlg &sigalg)
 Translate SignatureAlgorithm OID into SSL_Hash_TYPE and SSL_Key_TYPE. More...
 
static const char *GRAYCALL ReadSigAlgDesc (const cASNBuf &oid)
 Translate SignatureAlgorithm OID into description. More...
 
static const cOIDDefBase *GRAYCALL FindOIDForSigAlg (const cKeySigAlg &sigalg)
 Translate SSL_Hash_TYPE and SSL_Key_TYPE into SignatureAlgorithm OID. More...
 
static bool GRAYCALL ReadHashType (const cMemBlock &oid, OUT SSL_Hash_TYPE &reHashType)
 Translate hash algorithm OID into SSL_Hash_TYPE. More...
 
static const char *GRAYCALL GetExt_ExtKeyUsage (const cASNBuf &oid)
 Translate Extended Key Usage OID into description. More...
 
static const cOIDDefBase *GRAYCALL FindOIDForHashType (SSL_Hash_TYPE eHashType)
 Translate SSL_Hash_TYPE into hash algorithm OID. More...
 
static bool GRAYCALL FindCipherType (const cASNBuf &oid, SSL_Cipher_TYPE &reCipherType)
 Translate encryption algorithm OID into eCipherType. More...
 
static bool GRAYCALL FindPkcs12Pbe (const cASNBuf &oid, SSL_Hash_TYPE &reHashType, SSL_Cipher_TYPE &reCipherType)
 Translate PKCS#12 PBE algorithm OID into SSL_Hash_TYPE and SSL_Cipher_TYPE. More...
 
static StrLen_t GRAYCALL MakeNumDotStr (StrBuilder &s, const BYTE *pOid, size_t nSizeOid)
 
static const cOIDDefBase *GRAYCALL FindAny (const BYTE *pOid, size_t nSizeOid)
 
static StrLen_t GRAYCALL MakeStr (StrBuilder &s, const cASNBuf &oid)
 

Static Public Attributes

static const cOIDDefT1< const char * > k_oid_x520_attr_type []
 
static const cOIDDefBase k_oid_ext_key_usage []
 
static const cOIDDefT2< SSL_Hash_TYPE, SSL_Key_TYPE > k_oid_sig_alg []
 
static const cOIDDefT1< SSL_Key_TYPE > k_oid_KeyAlg []
 
static const cOIDDefT1< ECPGroup_TYPE > k_oid_ecp_grp []
 
static const cOIDDefT1< SSL_Hash_TYPE > k_oid_hash_def []
 

Detailed Description

Helper functions for looking up OID's (of a type) and reverse.

Member Function Documentation

◆ FindAny()

const cOIDDefBase *GRAYCALL GrayLib::cOID::FindAny ( const BYTE *  pOid,
size_t  nSizeOid 
)
static

Is this one of the OID's i know about?

◆ FindAttrShortName()

const char *GRAYCALL GrayLib::cOID::FindAttrShortName ( const cMemBlock &  oid)
static

Translate an X.509 attribute type OID into the short name (e.g. the OID for an X520 Common Name into "CN")

Get the short name for the OID.

◆ FindCipherType()

bool GrayLib::cOID::FindCipherType ( const cASNBuf &  oid,
SSL_Cipher_TYPE &  reCipherType 
)
static

Translate encryption algorithm OID into eCipherType.

Translate encryption algorithm OID into eCipherType

◆ FindECPGroupId()

bool GrayLib::cOID::FindECPGroupId ( const cMemBlock &  oid,
ECPGroup_TYPE &  eECPGroupId 
)
static

Translate NamedCurve OID into an EC group identifier.

◆ FindOIDForAttr()

const cOIDDefBase *GRAYCALL GrayLib::cOID::FindOIDForAttr ( const char *  name,
StrLen_t  name_len 
)
static

Get the corresponding OID for the certificate subject attributes. e.g.

◆ FindOIDForECPGroupId()

const cOIDDefBase * GrayLib::cOID::FindOIDForECPGroupId ( ECPGroup_TYPE  eECPGroupId)
static

Translate EC group identifier into NamedCurve OID.

◆ FindOIDForHashType()

const cOIDDefBase * GrayLib::cOID::FindOIDForHashType ( SSL_Hash_TYPE  eHashType)
static

Translate SSL_Hash_TYPE into hash algorithm OID.

◆ FindOIDForPrivateKeyType()

const cOIDDefBase * GrayLib::cOID::FindOIDForPrivateKeyType ( SSL_Key_TYPE  eKeyType)
static

Translate SSL_Key_TYPE into PublicKeyAlgorithm OID.

◆ FindOIDForSigAlg()

const cOIDDefBase * GrayLib::cOID::FindOIDForSigAlg ( const cKeySigAlg &  sigalg)
static

Translate SSL_Hash_TYPE and SSL_Key_TYPE into SignatureAlgorithm OID.

◆ FindPkcs12Pbe()

bool GrayLib::cOID::FindPkcs12Pbe ( const cASNBuf &  oid,
SSL_Hash_TYPE &  reHashType,
SSL_Cipher_TYPE &  reCipherType 
)
static

Translate PKCS#12 PBE algorithm OID into SSL_Hash_TYPE and SSL_Cipher_TYPE.

◆ FindPrivateKeyType()

bool GrayLib::cOID::FindPrivateKeyType ( const cMemBlock &  oid,
SSL_Key_TYPE &  eKeyType 
)
static

Translate PublicKeyAlgorithm OID into SSL_Key_TYPE.

◆ FindX509_EXT()

bool GrayLib::cOID::FindX509_EXT ( const cMemBlock &  oid,
OUT X509_EXT_t &  ext_type 
)
static

Translate an X.509 extension OID into local values.

Translate an X.509 extension OID into X509_EXT_t

◆ GetExt_ExtKeyUsage()

const char * GrayLib::cOID::GetExt_ExtKeyUsage ( const cASNBuf &  oid)
static

Translate Extended Key Usage OID into description.

◆ MakeNumDotStr()

StrLen_t GrayLib::cOID::MakeNumDotStr ( StrBuilder &  s,
const BYTE *  pOid,
size_t  nSizeOid 
)
static

Translate an ASN.1 OID into its numeric representation. for _DEBUG (e.g. "\x2A\x86\x48\x86\xF7\x0D" into "1.2.840.113549") http://www.oid-info.com/get/1.2.840.113549.1.1.4

  • s = buffer to put representation in
  • oid = OID to translate
    Returns
    Length of the string written (excluding final nullptr) or DISP_E_BUFFERTOOSMALL in case of error Return the "x.y.z...." style numeric string for the given OID. e.g. "1.2.3.4"

◆ MakeStr()

StrLen_t GRAYCALL GrayLib::cOID::MakeStr ( StrBuilder &  s,
const cASNBuf &  oid 
)
static

Make the best string we can to represent the OID.

◆ ReadHashType()

bool GrayLib::cOID::ReadHashType ( const cMemBlock &  oid,
OUT SSL_Hash_TYPE &  reHashType 
)
static

Translate hash algorithm OID into SSL_Hash_TYPE.

◆ ReadSigAlg()

bool GrayLib::cOID::ReadSigAlg ( const cASNBuf &  oid,
OUT cKeySigAlg &  sigalg 
)
static

Translate SignatureAlgorithm OID into SSL_Hash_TYPE and SSL_Key_TYPE.

◆ ReadSigAlgDesc()

const char * GrayLib::cOID::ReadSigAlgDesc ( const cASNBuf &  oid)
static

Translate SignatureAlgorithm OID into description.

Member Data Documentation

◆ k_oid_ecp_grp

const cOIDDefT1< ECPGroup_TYPE > GrayLib::cOID::k_oid_ecp_grp
static

◆ k_oid_ext_key_usage

const cOIDDefBase GrayLib::cOID::k_oid_ext_key_usage
static
Initial value:
=
{
{ STRLIT2(OID_SERVER_AUTH), "id-kp-serverAuth", "TLS Web Server Authentication" },
{ STRLIT2(OID_CLIENT_AUTH), "id-kp-clientAuth", "TLS Web Client Authentication" },
{ STRLIT2(OID_CODE_SIGNING), "id-kp-codeSigning", "Code Signing" },
{ STRLIT2(OID_EMAIL_PROTECTION), "id-kp-emailProtection", "E-mail Protection" },
{ STRLIT2(OID_TIME_STAMPING), "id-kp-timeStamping", "Time Stamping" },
{ STRLIT2(OID_OCSP_SIGNING), "id-kp-OCSPSigning", "OCSP Signing" },
{ nullptr, 0, nullptr, nullptr },
}
#define STRLIT2(s)
Macro to automatically add the size of literal string or fixed size buffer.
Definition: StrConst.h:36
#define OID_TIME_STAMPING
id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 }
Definition: cOID.h:144
#define OID_EMAIL_PROTECTION
id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 }
Definition: cOID.h:143
#define OID_CLIENT_AUTH
id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 }
Definition: cOID.h:141
#define OID_CODE_SIGNING
id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 }
Definition: cOID.h:142
#define OID_OCSP_SIGNING
id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 }
Definition: cOID.h:145
#define OID_SERVER_AUTH
id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 }
Definition: cOID.h:140

◆ k_oid_hash_def

const cOIDDefT1< SSL_Hash_TYPE > GrayLib::cOID::k_oid_hash_def
static

◆ k_oid_KeyAlg

const cOIDDefT1< SSL_Key_TYPE > GrayLib::cOID::k_oid_KeyAlg
static
Initial value:
=
{
{
{ STRLIT2(OID_PKCS1_RSA), "rsaEncryption", "RSA" },
},
{
{ STRLIT2(OID_EC_ALG_UNRESTRICTED), "id-ecPublicKey", "Generic EC key" },
},
{
{ STRLIT2(OID_EC_ALG_ECDH), "id-ecDH", "EC key for ECDH" },
},
{
{ nullptr, 0, nullptr, nullptr },
},
}
#define OID_EC_ALG_ECDH
Definition: cOID.h:237
#define OID_EC_ALG_UNRESTRICTED
Definition: cOID.h:232
#define OID_PKCS1_RSA
rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 }
Definition: cOID.h:158
@ SSL_Key_ECKEY_DH
OID_EC_ALG_ECDH.
Definition: cKeyBase.h:31
@ SSL_Key_RSA
SSL_KeyExchange_RSA = "PRIVATE KEY" = k_pszPEM_PK.
Definition: cKeyBase.h:29
@ SSL_Key_NONE
Definition: cKeyBase.h:28
@ SSL_Key_ECKEY
SSL_KeyExchange_ECDH_RSA = "EC PRIVATE KEY" = k_pszPEM_EC.
Definition: cKeyBase.h:30

◆ k_oid_sig_alg

const cOIDDefT2< SSL_Hash_TYPE, SSL_Key_TYPE > GrayLib::cOID::k_oid_sig_alg
static

◆ k_oid_x520_attr_type

const cOIDDefT1< const char * > GrayLib::cOID::k_oid_x520_attr_type
static

The documentation for this struct was generated from the following files: