My Project
asn_public.h
Go to the documentation of this file.
1 
22 int wc_InitCert(Cert*);
23 
54 Cert* wc_CertNew(void* heap);
55 
82 void wc_CertFree(Cert* cert);
83 
127 int wc_MakeCert(Cert* cert, byte* derBuffer, word32 derSz, RsaKey* rsaKey,
128  ecc_key* eccKey, WC_RNG* rng);
129 
174 int wc_MakeCertReq(Cert* cert, byte* derBuffer, word32 derSz,
175  RsaKey* rsaKey, ecc_key* eccKey);
176 
227 int wc_SignCert(int requestSz, int sigType, byte* derBuffer,
228  word32 derSz, RsaKey* rsaKey, ecc_key* eccKey, WC_RNG* rng);
229 
273 int wc_MakeSelfCert(Cert* cert, byte* derBuffer, word32 derSz, RsaKey* key,
274  WC_RNG* rng);
275 
335 int wc_SetIssuer(Cert* cert, const char* issuerFile);
336 
392 int wc_SetSubject(Cert* cert, const char* subjectFile);
393 
394 
457 int wc_SetSubjectRaw(Cert* cert, const byte* der, int derSz);
458 
485 int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert);
486 
544 int wc_SetAltNames(Cert* cert, const char* file);
545 
608 int wc_SetIssuerBuffer(Cert* cert, const byte* der, int derSz);
609 
672 int wc_SetIssuerRaw(Cert* cert, const byte* der, int derSz);
673 
735 int wc_SetSubjectBuffer(Cert* cert, const byte* der, int derSz);
736 
801 int wc_SetAltNamesBuffer(Cert* cert, const byte* der, int derSz);
802 
864 int wc_SetDatesBuffer(Cert* cert, const byte* der, int derSz);
865 
898 int wc_SetAuthKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey,
899  ecc_key *eckey);
900 
929 int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz);
930 
958 int wc_SetAuthKeyId(Cert *cert, const char* file);
959 
989 int wc_SetSubjectKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey,
990  ecc_key *eckey);
991 
1020 int wc_SetSubjectKeyId(Cert *cert, const char* file);
1021 
1054 int wc_SetKeyUsage(Cert *cert, const char *value);
1055 
1084 int wc_PemPubKeyToDer(const char* fileName,
1085  unsigned char* derBuf, int derSz);
1086 
1116 int wc_PubKeyPemToDer(const unsigned char* pem, int pemSz,
1117  unsigned char* buff, int buffSz);
1118 
1152 int wc_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz);
1153 
1194 int wc_DerToPem(const byte* der, word32 derSz, byte* output,
1195  word32 outputSz, int type);
1196 
1239 int wc_DerToPemEx(const byte* der, word32 derSz, byte* output,
1240  word32 outputSz, byte *cipherIno, int type);
1241 
1277 int wc_KeyPemToDer(const unsigned char* pem, int pemSz,
1278  unsigned char* buff, int buffSz, const char* pass);
1279 
1309 int wc_CertPemToDer(const unsigned char* pem, int pemSz,
1310  unsigned char* buff, int buffSz, int type);
1311 
1332 int wc_GetPubKeyDerFromCert(struct DecodedCert* cert,
1333  byte* derKey, word32* derKeySz);
1334 
1392 int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx,
1393  ecc_key* key, word32 inSz);
1394 
1437 int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen);
1438 
1471 int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
1472  ecc_key* key, word32 inSz);
1473 
1512 int wc_EccPublicKeyToDer(ecc_key* key, byte* output,
1513  word32 inLen, int with_AlgCurve);
1514 
1557 int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output,
1558  word32 inLen, int with_AlgCurve, int comp);
1559 
1560 
1597 int wc_Curve25519PrivateKeyDecode(const byte* input, word32* inOutIdx,
1598  curve25519_key* key, word32 inSz);
1599 
1635 int wc_Curve25519PublicKeyDecode(const byte* input, word32* inOutIdx,
1636  curve25519_key* key, word32 inSz);
1637 
1673 int wc_Curve25519KeyDecode(const byte* input, word32* inOutIdx,
1674  curve25519_key* key, word32 inSz);
1675 
1705 int wc_Curve25519PrivateKeyToDer(curve25519_key* key, byte* output,
1706  word32 inLen);
1707 
1738 int wc_Curve25519PublicKeyToDer(curve25519_key* key, byte* output, word32 inLen,
1739  int withAlg);
1740 
1770 int wc_Curve25519KeyToDer(curve25519_key* key, byte* output, word32 inLen,
1771  int withAlg);
1772 
1806 word32 wc_EncodeSignature(byte* out, const byte* digest,
1807  word32 digSz, int hashOID);
1808 
1836 int wc_GetCTC_HashOID(int type);
1837 
1867 void wc_SetCert_Free(Cert* cert);
1868 
1900  word32* inOutIdx, word32 sz);
1901 
1950 int wc_CreatePKCS8Key(byte* out, word32* outSz,
1951  byte* key, word32 keySz, int algoID, const byte* curveOID,
1952  word32 oidSz);
1953 
2011 int wc_EncryptPKCS8Key(byte* key, word32 keySz, byte* out,
2012  word32* outSz, const char* password, int passwordSz, int vPKCS,
2013  int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt,
2014  WC_RNG* rng, void* heap);
2015 
2048 int wc_DecryptPKCS8Key(byte* input, word32 sz, const char* password,
2049  int passwordSz);
2050 
2107 int wc_CreateEncryptedPKCS8Key(byte* key, word32 keySz, byte* out,
2108  word32* outSz, const char* password, int passwordSz, int vPKCS,
2109  int pbeOid, int encAlgId, byte* salt, word32 saltSz, int itt,
2110  WC_RNG* rng, void* heap);
2111 
2137 void wc_InitDecodedCert(struct DecodedCert* cert,
2138  const byte* source, word32 inSz, void* heap);
2139 
2176 int wc_ParseCert(DecodedCert* cert, int type, int verify, void* cm);
2177 
2204 void wc_FreeDecodedCert(struct DecodedCert* cert);
2205 
2235 int wc_SetTimeCb(wc_time_cb f);
2236 
2257 time_t wc_Time(time_t* t);
2258 
2306 int wc_SetCustomExtension(Cert *cert, int critical, const char *oid,
2307  const byte *der, word32 derSz);
2308 
2360 int wc_SetUnknownExtCallback(DecodedCert* cert,
2361  wc_UnknownExtCallback cb);
2380 int wc_CheckCertSigPubKey(const byte* cert, word32 certSz,
2381  void* heap, const byte* pubKey,
2382  word32 pubKeySz, int pubKeyOID);
2383 
2405 int wc_Asn1PrintOptions_Init(Asn1PrintOptions* opts);
2406 
2433 int wc_Asn1PrintOptions_Set(Asn1PrintOptions* opts, enum Asn1PrintOpt opt,
2434  word32 val);
2435 
2457 int wc_Asn1_Init(Asn1* asn1);
2458 
2485 int wc_Asn1_SetFile(Asn1* asn1, XFILE file);
2486 
2525 int wc_Asn1_PrintAll(Asn1* asn1, Asn1PrintOptions* opts, unsigned char* data,
2526  word32 len);
2527 
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...
int wc_SetSubject(Cert *cert, const char *subjectFile)
This function sets the subject for a certificate to the subject in the provided pem subjectFile....
int wc_Curve25519PrivateKeyDecode(const byte *input, word32 *inOutIdx, curve25519_key *key, word32 inSz)
This function decodes a Curve25519 private key (only) from a DER encoded buffer.
int wc_CheckCertSigPubKey(const byte *cert, word32 certSz, void *heap, const byte *pubKey, word32 pubKeySz, int pubKeyOID)
This function verifies the signature in the der form of an X.509 certificate against a public key....
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...
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...
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...
int wc_Asn1_PrintAll(Asn1 *asn1, Asn1PrintOptions *opts, unsigned char *data, word32 len)
Print all ASN.1 items.
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....
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....
void wc_FreeDecodedCert(struct DecodedCert *cert)
This function frees a DecodedCert that was previously initialized with wc_InitDecodedCert.
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...
int wc_Curve25519PrivateKeyToDer(curve25519_key *key, byte *output, word32 inLen)
This function encodes a Curve25519 private key to DER format. If the input key structure contains a p...
int wc_Curve25519KeyDecode(const byte *input, word32 *inOutIdx, curve25519_key *key, word32 inSz)
This function decodes a Curve25519 key from a DER encoded buffer. It can decode either a private key,...
int wc_SetSubjectKeyId(Cert *cert, const char *file)
Set SKID from public key file in PEM format. Both arguments are required.
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...
int wc_SetIssuer(Cert *cert, const char *issuerFile)
This function sets the issuer for a certificate to the issuer in the provided pem issuerFile....
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.
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,...
int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert)
This function gets the raw subject from the certificate structure.
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...
Cert * wc_CertNew(void *heap)
This function allocates a new Cert structure for use during cert operations without the application h...
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,...
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....
time_t wc_Time(time_t *t)
This function gets the current time. By default, it uses the XTIME macro, which varies between platfo...
int wc_Curve25519PublicKeyDecode(const byte *input, word32 *inOutIdx, curve25519_key *key, word32 inSz)
This function decodes a Curve25519 public key (only) from a DER encoded buffer.
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...
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....
void wc_CertFree(Cert *cert)
This function frees the memory allocated for a cert structure by a previous call to wc_CertNew().
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...
int wc_EccPublicKeyToDer_ex(ecc_key *key, byte *output, word32 inLen, int with_AlgCurve, int comp)
This function converts the ECC public key to DER format. It returns the size of buffer used....
int wc_SetSubjectKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey)
Set SKID from RSA or ECC public key.
int wc_EccKeyToDer(ecc_key *key, byte *output, word32 inLen)
This function writes a private ECC key to der format.
int wc_Asn1_Init(Asn1 *asn1)
This function initializes an ASN.1 parsing object.
int wc_SetUnknownExtCallback(DecodedCert *cert, wc_UnknownExtCallback cb)
This function registers a callback that will be used anytime wolfSSL encounters an unknown X....
int wc_Asn1PrintOptions_Init(Asn1PrintOptions *opts)
This function initializes the ASN.1 print options.
int wc_Curve25519KeyToDer(curve25519_key *key, byte *output, word32 inLen, int withAlg)
This function encodes a Curve25519 key to DER format. It can encode either a private key,...
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....
int wc_Asn1PrintOptions_Set(Asn1PrintOptions *opts, enum Asn1PrintOpt opt, word32 val)
This function sets a print option into an ASN.1 print options object.
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. note: The content at the address...
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....
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...
int wc_Curve25519PublicKeyToDer(curve25519_key *key, byte *output, word32 inLen, int withAlg)
This function encodes a Curve25519 public key to DER format. If the input key structure contains a pr...
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....
int wc_GetCTC_HashOID(int type)
This function returns the hash OID that corresponds to a hashing type. For example,...
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....
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...
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...
int wc_InitCert(Cert *)
This function initializes a default cert, with the default options: version = 3 (0x2),...
int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz)
Set AKID from from DER encoded certificate.
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...
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,...
int wc_SetAuthKeyId(Cert *cert, const char *file)
Set AKID from certificate file in PEM format.
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....
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.
void wc_SetCert_Free(Cert *cert)
This function cleans up memory and resources used by the certificate structure's decoded cert cache....
int wc_Asn1_SetFile(Asn1 *asn1, XFILE file)
This function sets the file to use when printing into an ASN.1 parsing object.
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,...
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....
int wc_GetPubKeyDerFromCert(struct DecodedCert *cert, byte *derKey, word32 *derKeySz)
This function gets the public key in DER format from a populated DecodedCert struct....
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.
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.
int wc_SetKeyUsage(Cert *cert, const char *value)
This function allows you to set the key usage using a comma delimited string of tokens....