My Project
|
Go to the source code of this file.
Functions | |
int | wc_InitCert (Cert *) |
This function initializes a default cert, with the default options: version = 3 (0x2), serial = 0, sigType = SHA_WITH_RSA, issuer = blank, daysValid = 500, selfSigned = 1 (true) use subject as issuer, subject = blank. More... | |
Cert * | wc_CertNew (void *heap) |
This function allocates a new Cert structure for use during cert operations without the application having to allocate the structure itself. The Cert structure is also initialized by this function thus removing the need to call wc_InitCert(). When the application is finished using the allocated Cert structure wc_CertFree() must be called. More... | |
void | wc_CertFree (Cert *cert) |
This function frees the memory allocated for a cert structure by a previous call to wc_CertNew(). More... | |
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. This function makes an x509 Certificate v3 RSA or ECC from a cert input. It then writes this cert to derBuffer. It takes in either an rsaKey or an eccKey to generate the certificate. The certificate must be initialized with wc_InitCert before this method is called. More... | |
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 to derBuffer. It takes in either an rsaKey or an eccKey to generate the certificate request. wc_SignCert() will need to be called after this function to sign the certificate request. Please see the wolfCrypt test application (./wolfcrypt/test/test.c) for an example usage of this function. More... | |
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. Must be called after wc_MakeCert() or wc_MakeCertReq() if creating a CA signed cert. More... | |
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 signing (the previous functions may be used for CA requests). It makes a certificate, and then signs it, generating a self-signed certificate. More... | |
int | wc_SetIssuer (Cert *cert, const char *issuerFile) |
This function sets the issuer for a certificate to the issuer in the provided pem issuerFile. It also changes the certificate’s self-signed attribute to false. The issuer specified in issuerFile is verified prior to setting the cert issuer. This method is used to set fields prior to signing. More... | |
int | wc_SetSubject (Cert *cert, const char *subjectFile) |
This function sets the subject for a certificate to the subject in the provided pem subjectFile. This method is used to set fields prior to signing. More... | |
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. This method is used to set the raw subject field prior to signing. More... | |
int | wc_GetSubjectRaw (byte **subjectRaw, Cert *cert) |
This function gets the raw subject from the certificate structure. More... | |
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 file. This is useful in the case that one wishes to secure multiple domains with the same certificate. This method is used to set fields prior to signing. More... | |
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. It also changes the certificate’s self-signed attribute to false. This method is used to set fields prior to signing. More... | |
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. This method is used to set the raw issuer field prior to signing. More... | |
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. This method is used to set fields prior to signing. More... | |
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 buffer. This is useful in the case that one wishes to secure multiple domains with the same certificate. This method is used to set fields prior to signing. More... | |
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. This method is used to set fields prior to signing. More... | |
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, not both. More... | |
int | wc_SetAuthKeyIdFromCert (Cert *cert, const byte *der, int derSz) |
Set AKID from from DER encoded certificate. More... | |
int | wc_SetAuthKeyId (Cert *cert, const char *file) |
Set AKID from certificate file in PEM format. More... | |
int | wc_SetSubjectKeyIdFromPublicKey (Cert *cert, RsaKey *rsakey, ecc_key *eckey) |
Set SKID from RSA or ECC public key. More... | |
int | wc_SetSubjectKeyId (Cert *cert, const char *file) |
Set SKID from public key file in PEM format. Both arguments are required. More... | |
int | wc_SetKeyUsage (Cert *cert, const char *value) |
This function allows you to set the key usage using a comma delimited string of tokens. Accepted tokens are: digitalSignature, nonRepudiation, contentCommitment, keyCertSign, cRLSign, dataEncipherment, keyAgreement, keyEncipherment, encipherOnly, decipherOnly. Example: "digitalSignature,nonRepudiation" nonRepudiation and contentCommitment are for the same usage. More... | |
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. More... | |
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 negative value for an error. More... | |
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 in the derBuf buffer provided. More... | |
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, into a pem formatted output certificate, contained in the output buffer. It should be noted that this is not an in place conversion, and a separate buffer must be utilized to store the pem formatted output. More... | |
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, into a pem formatted output certificate, contained in the output buffer. It should be noted that this is not an in place conversion, and a separate buffer must be utilized to store the pem formatted output. Allows setting cipher info. More... | |
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. More... | |
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. More... | |
int | wc_GetPubKeyDerFromCert (struct DecodedCert *cert, byte *derKey, word32 *derKeySz) |
This function gets the public key in DER format from a populated DecodedCert struct. Users must call wc_InitDecodedCert() and wc_ParseCert() before calling this API. wc_InitDecodedCert() accepts a DER/ASN.1 encoded certificate. To convert a PEM cert to DER, first use wc_CertPemToDer() before calling wc_InitDecodedCert(). More... | |
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, and uses it to generate an ecc_key object, which it stores in key. More... | |
int | wc_EccKeyToDer (ecc_key *key, byte *output, word32 inLen) |
This function writes a private ECC key to der format. More... | |
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. More... | |
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. The public ECC key in DER format is stored in output buffer. The with_AlgCurve flag will include a header that has the Algorithm and Curve information. More... | |
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. The public ECC key in DER format is stored in output buffer. The with_AlgCurve flag will include a header that has the Algorithm and Curve information. The comp parameter determines if the public key will be exported as compressed. More... | |
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. More... | |
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. More... | |
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, a public key, or both. More... | |
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 public key, it will be ignored. More... | |
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 private key, it will be ignored. More... | |
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, a public key, or both. More... | |
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 signature created. More... | |
int | wc_GetCTC_HashOID (int type) |
This function returns the hash OID that corresponds to a hashing type. For example, when given the type: WC_SHA512, this function returns the identifier corresponding to a SHA512 hash, SHA512h. More... | |
void | wc_SetCert_Free (Cert *cert) |
This function cleans up memory and resources used by the certificate structure's decoded cert cache. When WOLFSSL_CERT_GEN_CACHE is defined the decoded cert structure is cached in the certificate structure. This allows subsequent calls to certificate set functions to avoid parsing the decoded cert on each call. More... | |
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. More... | |
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#12 shrouded key bags. See RFC 5208. More... | |
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 converts it to PKCS#8 encrypted format. The resulting encrypted key can be decrypted using wc_DecryptPKCS8Key. See RFC 5208. More... | |
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. Undoes the encryption done by wc_EncryptPKCS8Key. See RFC5208. The input buffer is overwritten with the decrypted data. More... | |
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. It uses wc_CreatePKCS8Key and wc_EncryptPKCS8Key to do this. More... | |
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" pointer to a DER-encoded certificate of length "inSz." This certificate can be parsed by a subsequent call to wc_ParseCert. More... | |
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 fields of that object. The DecodedCert must have been initialized with a prior call to wc_InitDecodedCert. This function takes an optional pointer to a CertificateManager object, which is used to populate the certificate authority information of the DecodedCert, if the CA is found in the CertificateManager. More... | |
void | wc_FreeDecodedCert (struct DecodedCert *cert) |
This function frees a DecodedCert that was previously initialized with wc_InitDecodedCert. More... | |
int | wc_SetTimeCb (wc_time_cb f) |
This function registers a time callback that will be used anytime wolfSSL needs to get the current time. The prototype of the callback should be the same as the "time" function from the C standard library. More... | |
time_t | wc_Time (time_t *t) |
This function gets the current time. By default, it uses the XTIME macro, which varies between platforms. The user can use a function of their choosing instead via the wc_SetTimeCb function. More... | |
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 pointed to by any of the parameters that are pointers must not be modified until the certificate is generated and you have the der output. This function does NOT copy the contents to another buffer. More... | |
int | wc_SetUnknownExtCallback (DecodedCert *cert, wc_UnknownExtCallback cb) |
This function registers a callback that will be used anytime wolfSSL encounters an unknown X.509 extension in a certificate while parsing a certificate. The prototype of the callback should be: More... | |
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. The public key is expected to be the full subject public key info in der form. More... | |
int | wc_Asn1PrintOptions_Init (Asn1PrintOptions *opts) |
This function initializes the ASN.1 print options. More... | |
int | wc_Asn1PrintOptions_Set (Asn1PrintOptions *opts, enum Asn1PrintOpt opt, word32 val) |
This function sets a print option into an ASN.1 print options object. More... | |
int | wc_Asn1_Init (Asn1 *asn1) |
This function initializes an ASN.1 parsing object. More... | |
int | wc_Asn1_SetFile (Asn1 *asn1, XFILE file) |
This function sets the file to use when printing into an ASN.1 parsing object. More... | |
int | wc_Asn1_PrintAll (Asn1 *asn1, Asn1PrintOptions *opts, unsigned char *data, word32 len) |
Print all ASN.1 items. More... | |