My Project
asn_public.h
Go to the documentation of this file.
1 
22 int wc_InitCert(Cert*);
23 
67 int wc_MakeCert(Cert* cert, byte* derBuffer, word32 derSz, RsaKey* rsaKey,
68  ecc_key* eccKey, WC_RNG* rng);
69 
114 int wc_MakeCertReq(Cert* cert, byte* derBuffer, word32 derSz,
115  RsaKey* rsaKey, ecc_key* eccKey);
116 
167 int wc_SignCert(int requestSz, int sigType, byte* derBuffer,
168  word32 derSz, RsaKey* rsaKey, ecc_key* eccKey, WC_RNG* rng);
169 
213 int wc_MakeSelfCert(Cert* cert, byte* derBuffer, word32 derSz, RsaKey* key,
214  WC_RNG* rng);
215 
275 int wc_SetIssuer(Cert* cert, const char* issuerFile);
276 
332 int wc_SetSubject(Cert* cert, const char* subjectFile);
333 
334 
397 int wc_SetSubjectRaw(Cert* cert, const byte* der, int derSz);
398 
425 int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert);
426 
484 int wc_SetAltNames(Cert* cert, const char* file);
485 
548 int wc_SetIssuerBuffer(Cert* cert, const byte* der, int derSz);
549 
612 int wc_SetIssuerRaw(Cert* cert, const byte* der, int derSz);
613 
675 int wc_SetSubjectBuffer(Cert* cert, const byte* der, int derSz);
676 
741 int wc_SetAltNamesBuffer(Cert* cert, const byte* der, int derSz);
742 
804 int wc_SetDatesBuffer(Cert* cert, const byte* der, int derSz);
805 
838 int wc_SetAuthKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey,
839  ecc_key *eckey);
840 
869 int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz);
870 
898 int wc_SetAuthKeyId(Cert *cert, const char* file);
899 
929 int wc_SetSubjectKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey,
930  ecc_key *eckey);
931 
960 int wc_SetSubjectKeyId(Cert *cert, const char* file);
961 
994 int wc_SetKeyUsage(Cert *cert, const char *value);
995 
1024 int wc_PemPubKeyToDer(const char* fileName,
1025  unsigned char* derBuf, int derSz);
1026 
1056 int wc_PubKeyPemToDer(const unsigned char* pem, int pemSz,
1057  unsigned char* buff, int buffSz);
1058 
1092 int wc_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz);
1093 
1134 int wc_DerToPem(const byte* der, word32 derSz, byte* output,
1135  word32 outputSz, int type);
1136 
1179 int wc_DerToPemEx(const byte* der, word32 derSz, byte* output,
1180  word32 outputSz, byte *cipherIno, int type);
1181 
1217 int wc_KeyPemToDer(const unsigned char* pem, int pemSz,
1218  unsigned char* buff, int buffSz, const char* pass);
1219 
1249 int wc_CertPemToDer(const unsigned char* pem, int pemSz,
1250  unsigned char* buff, int buffSz, int type);
1251 
1272 int wc_GetPubKeyDerFromCert(struct DecodedCert* cert,
1273  byte* derKey, word32* derKeySz);
1274 
1332 int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx,
1333  ecc_key* key, word32 inSz);
1334 
1377 int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen);
1378 
1411 int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
1412  ecc_key* key, word32 inSz);
1413 
1452 int wc_EccPublicKeyToDer(ecc_key* key, byte* output,
1453  word32 inLen, int with_AlgCurve);
1454 
1488 word32 wc_EncodeSignature(byte* out, const byte* digest,
1489  word32 digSz, int hashOID);
1490 
1518 int wc_GetCTC_HashOID(int type);
1519 
1549 void wc_SetCert_Free(Cert* cert);
1550 
1581 int wc_GetPkcs8TraditionalOffset(byte* input,
1582  word32* inOutIdx, word32 sz);
1583 
1632 int wc_CreatePKCS8Key(byte* out, word32* outSz,
1633  byte* key, word32 keySz, int algoID, const byte* curveOID,
1634  word32 oidSz);
1635 
1693 int wc_EncryptPKCS8Key(byte* key, word32 keySz, byte* out,
1694  word32* outSz, const char* password, int passwordSz, int vPKCS,
1695  int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt,
1696  WC_RNG* rng, void* heap);
1697 
1730 int wc_DecryptPKCS8Key(byte* input, word32 sz, const char* password,
1731  int passwordSz);
1732 
1789 int wc_CreateEncryptedPKCS8Key(byte* key, word32 keySz, byte* out,
1790  word32* outSz, const char* password, int passwordSz, int vPKCS,
1791  int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt,
1792  WC_RNG* rng, void* heap);
1793 
1819 void wc_InitDecodedCert(struct DecodedCert* cert,
1820  const byte* source, word32 inSz, void* heap);
1821 
1858 int wc_ParseCert(DecodedCert* cert, int type, int verify, void* cm);
1859 
1886 void wc_FreeDecodedCert(struct DecodedCert* cert);
1887 
1917 int wc_SetTimeCb(wc_time_cb f);
1918 
1939 time_t wc_Time(time_t* t);
1940 
1984 int wc_SetCustomExtension(Cert *cert, int critical, const char *oid,
1985  const byte *der, word32 derSz);
1986 
2038 WOLFSSL_ASN_API int wc_SetUnknownExtCallback(DecodedCert* cert,
2039  wc_UnknownExtCallback cb);
wc_EccPublicKeyDecode
int wc_EccPublicKeyDecode(const byte *input, word32 *inOutIdx, ecc_key *key, word32 inSz)
Decodes an ECC public key from an input buffer. It will parse an ASN sequence to retrieve the ECC key...
wc_PubKeyPemToDer
int wc_PubKeyPemToDer(const unsigned char *pem, int pemSz, unsigned char *buff, int buffSz)
Convert a PEM encoded public key to DER. Returns the number of bytes written to the buffer or a negat...
wc_SetAuthKeyIdFromPublicKey
int wc_SetAuthKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey)
Set AKID from either an RSA or ECC public key. note: Only set one of rsakey or eckey,...
wc_SetIssuerBuffer
int wc_SetIssuerBuffer(Cert *cert, const byte *der, int derSz)
This function sets the issuer for a certificate from the issuer in the provided der buffer....
wc_SetSubject
int wc_SetSubject(Cert *cert, const char *subjectFile)
This function sets the subject for a certificate to the subject in the provided pem subjectFile....
wc_MakeCertReq
int wc_MakeCertReq(Cert *cert, byte *derBuffer, word32 derSz, RsaKey *rsaKey, ecc_key *eccKey)
This function makes a certificate signing request using the input certificate and writes the output t...
wc_PemPubKeyToDer
int wc_PemPubKeyToDer(const char *fileName, unsigned char *derBuf, int derSz)
Loads a PEM key from a file and converts to a DER encoded buffer.
wc_InitCert
int wc_InitCert(Cert *)
This function initializes a default cert, with the default options: version = 3 (0x2),...
wc_SetIssuer
int wc_SetIssuer(Cert *cert, const char *issuerFile)
This function sets the issuer for a certificate to the issuer in the provided pem issuerFile....
wc_KeyPemToDer
int wc_KeyPemToDer(const unsigned char *pem, int pemSz, unsigned char *buff, int buffSz, const char *pass)
Converts a key in PEM format to DER format.
wc_CertPemToDer
int wc_CertPemToDer(const unsigned char *pem, int pemSz, unsigned char *buff, int buffSz, int type)
This function converts a PEM formatted certificate to DER format. Calls OpenSSL function PemToDer.
wc_SetSubjectKeyIdFromPublicKey
int wc_SetSubjectKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey)
Set SKID from RSA or ECC public key.
wc_EccKeyToDer
int wc_EccKeyToDer(ecc_key *key, byte *output, word32 inLen)
This function writes a private ECC key to der format.
wc_ParseCert
int wc_ParseCert(DecodedCert *cert, int type, int verify, void *cm)
This function parses the DER-encoded certificate saved in the DecodedCert object and populates the fi...
wc_SetIssuerRaw
int wc_SetIssuerRaw(Cert *cert, const byte *der, int derSz)
This function sets the raw issuer for a certificate from the issuer in the provided der buffer....
wc_SetKeyUsage
int wc_SetKeyUsage(Cert *cert, const char *value)
This function allows you to set the key usage using a comma delimited string of tokens....
wc_CreatePKCS8Key
int wc_CreatePKCS8Key(byte *out, word32 *outSz, byte *key, word32 keySz, int algoID, const byte *curveOID, word32 oidSz)
This function takes in a DER private key and converts it to PKCS#8 format. Also used in creating PKCS...
wc_SetAltNames
int wc_SetAltNames(Cert *cert, const char *file)
This function sets the alternate names for a certificate to the alternate names in the provided pem f...
wc_SetAuthKeyIdFromCert
int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz)
Set AKID from from DER encoded certificate.
wc_SetSubjectKeyId
int wc_SetSubjectKeyId(Cert *cert, const char *file)
Set SKID from public key file in PEM format. Both arguments are required.
wc_SetTimeCb
int wc_SetTimeCb(wc_time_cb f)
This function registers a time callback that will be used anytime wolfSSL needs to get the current ti...
wc_Time
time_t wc_Time(time_t *t)
This function gets the current time. By default, it uses the XTIME macro, which varies between platfo...
wc_EccPublicKeyToDer
int wc_EccPublicKeyToDer(ecc_key *key, byte *output, word32 inLen, int with_AlgCurve)
This function converts the ECC public key to DER format. It returns the size of buffer used....
wc_GetPkcs8TraditionalOffset
int wc_GetPkcs8TraditionalOffset(byte *input, word32 *inOutIdx, word32 sz)
This function finds the beginning of the traditional private key inside a PKCS#8 unencrypted buffer.
wc_DerToPemEx
int wc_DerToPemEx(const byte *der, word32 derSz, byte *output, word32 outputSz, byte *cipherIno, int type)
This function converts a der formatted input certificate, contained in the der buffer,...
wc_GetPubKeyDerFromCert
int wc_GetPubKeyDerFromCert(struct DecodedCert *cert, byte *derKey, word32 *derKeySz)
This function gets the public key in DER format from a populated DecodedCert struct....
wc_SetCert_Free
void wc_SetCert_Free(Cert *cert)
This function cleans up memory and resources used by the certificate structure's decoded cert cache....
wc_SetSubjectRaw
int wc_SetSubjectRaw(Cert *cert, const byte *der, int derSz)
This function sets the raw subject for a certificate from the subject in the provided der buffer....
wc_SetDatesBuffer
int wc_SetDatesBuffer(Cert *cert, const byte *der, int derSz)
This function sets the dates for a certificate from the date range in the provided der buffer....
wc_MakeSelfCert
int wc_MakeSelfCert(Cert *cert, byte *derBuffer, word32 derSz, RsaKey *key, WC_RNG *rng)
This function is a combination of the previous two functions, wc_MakeCert and wc_SignCert for self si...
wc_SetAltNamesBuffer
int wc_SetAltNamesBuffer(Cert *cert, const byte *der, int derSz)
This function sets the alternate names for a certificate from the alternate names in the provided der...
wc_SetCustomExtension
int wc_SetCustomExtension(Cert *cert, int critical, const char *oid, const byte *der, word32 derSz)
This function injects a custom extension in to an X.509 certificate.
wc_EncryptPKCS8Key
int wc_EncryptPKCS8Key(byte *key, word32 keySz, byte *out, word32 *outSz, const char *password, int passwordSz, int vPKCS, int pbeOid, int encAlgId, byte *salt, word32 saltSz, int itt, WC_RNG *rng, void *heap)
This function takes in an unencrypted PKCS#8 DER key (e.g. one created by wc_CreatePKCS8Key) and conv...
wc_GetCTC_HashOID
int wc_GetCTC_HashOID(int type)
This function returns the hash OID that corresponds to a hashing type. For example,...
wc_FreeDecodedCert
void wc_FreeDecodedCert(struct DecodedCert *cert)
This function frees a DecodedCert that was previously initialized with wc_InitDecodedCert.
wc_CreateEncryptedPKCS8Key
int wc_CreateEncryptedPKCS8Key(byte *key, word32 keySz, byte *out, word32 *outSz, const char *password, int passwordSz, int vPKCS, int pbeOid, int encAlgId, byte *salt, word32 saltSz, int itt, WC_RNG *rng, void *heap)
This function takes a traditional, DER key, converts it to PKCS#8 format, and encrypts it....
wc_SetUnknownExtCallback
WOLFSSL_ASN_API int wc_SetUnknownExtCallback(DecodedCert *cert, wc_UnknownExtCallback cb)
This function registers a callback that will be used anytime wolfSSL encounters an unknown X....
wc_SignCert
int wc_SignCert(int requestSz, int sigType, byte *derBuffer, word32 derSz, RsaKey *rsaKey, ecc_key *eccKey, WC_RNG *rng)
This function signs buffer and adds the signature to the end of buffer. It takes in a signature type....
wc_PemCertToDer
int wc_PemCertToDer(const char *fileName, unsigned char *derBuf, int derSz)
This function converts a pem certificate to a der certificate, and places the resulting certificate i...
wc_MakeCert
int wc_MakeCert(Cert *cert, byte *derBuffer, word32 derSz, RsaKey *rsaKey, ecc_key *eccKey, WC_RNG *rng)
Used to make CA signed certs. Called after the subject information has been entered....
wc_DerToPem
int wc_DerToPem(const byte *der, word32 derSz, byte *output, word32 outputSz, int type)
This function converts a der formatted input certificate, contained in the der buffer,...
wc_SetAuthKeyId
int wc_SetAuthKeyId(Cert *cert, const char *file)
Set AKID from certificate file in PEM format.
wc_SetSubjectBuffer
int wc_SetSubjectBuffer(Cert *cert, const byte *der, int derSz)
This function sets the subject for a certificate from the subject in the provided der buffer....
wc_EccPrivateKeyDecode
int wc_EccPrivateKeyDecode(const byte *input, word32 *inOutIdx, ecc_key *key, word32 inSz)
This function reads in an ECC private key from the input buffer, input, parses the private key,...
wc_EncodeSignature
word32 wc_EncodeSignature(byte *out, const byte *digest, word32 digSz, int hashOID)
This function encodes a digital signature into the output buffer, and returns the size of the encoded...
wc_GetSubjectRaw
int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert)
This function gets the raw subject from the certificate structure.
wc_DecryptPKCS8Key
int wc_DecryptPKCS8Key(byte *input, word32 sz, const char *password, int passwordSz)
This function takes an encrypted PKCS#8 DER key and decrypts it to PKCS#8 unencrypted DER....
wc_InitDecodedCert
void wc_InitDecodedCert(struct DecodedCert *cert, const byte *source, word32 inSz, void *heap)
This function initializes the DecodedCert pointed to by the "cert" parameter. It saves the "source" p...