
Functions | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_MakeCert (Cert *, byte *derBuffer, word32 derSz, RsaKey *, ecc_key *, WC_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... | |
| WOLFSSL_API int | wc_MakeCertReq (Cert *, byte *derBuffer, word32 derSz, RsaKey *, ecc_key *) |
| 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... | |
| WOLFSSL_API int | wc_SignCert (int requestSz, int sigType, byte *derBuffer, word32 derSz, RsaKey *, ecc_key *, WC_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... | |
| WOLFSSL_API int | wc_MakeSelfCert (Cert *, byte *derBuffer, word32 derSz, RsaKey *, WC_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... | |
| WOLFSSL_API int | wc_SetIssuer (Cert *, const char *) |
| 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... | |
| WOLFSSL_API int | wc_SetSubject (Cert *, const char *) |
| 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_GetSubjectRaw (byte **subjectRaw, Cert *cert) |
| This function gets the raw subject from the certificate structure. More... | |
| WOLFSSL_API int | wc_SetAltNames (Cert *, const char *) |
| 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... | |
| WOLFSSL_API int | wc_SetIssuerBuffer (Cert *, const byte *, int) |
| 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_SetSubjectBuffer (Cert *, const byte *, int) |
| 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... | |
| WOLFSSL_API int | wc_SetAltNamesBuffer (Cert *, const byte *, int) |
| 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... | |
| WOLFSSL_API int | wc_SetDatesBuffer (Cert *, const byte *, int) |
| 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_SetAuthKeyIdFromCert (Cert *cert, const byte *der, int derSz) |
| Set AKID from from DER encoded certificate. More... | |
| WOLFSSL_API int | wc_SetAuthKeyId (Cert *cert, const char *file) |
| Set AKID from certificate file in PEM format. More... | |
| WOLFSSL_API int | wc_SetSubjectKeyIdFromPublicKey (Cert *cert, RsaKey *rsakey, ecc_key *eckey) |
| Set SKID from RSA or ECC public key. More... | |
| WOLFSSL_API int | wc_SetSubjectKeyId (Cert *cert, const char *file) |
| Set SKID from public key file in PEM format. Both arguments are required. More... | |
| WOLFSSL_API int | wc_SetSubjectKeyIdFromNtruPublicKey (Cert *cert, byte *ntruKey, word16 ntruKeySz) |
| Set SKID from NTRU public key. More... | |
| WOLFSSL_API int | wc_MakeNtruCert (Cert *, byte *derBuffer, word32 derSz, const byte *ntruKey, word16 keySz, WC_RNG *) |
| Used to make CA signed certs. Called after the subject information has been entered. This function makes an NTRU Certificate from a cert input. It then writes this cert to derBuffer. It takes in an ntruKey and a rng to generate the certificate. The certificate must be initialized with wc_InitCert before this method is called. More... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_PubKeyPemToDer (const unsigned char *, int, unsigned char *, int) |
| 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_EccPrivateKeyDecode (const byte *, word32 *, ecc_key *, word32) |
| 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... | |
| WOLFSSL_API int | wc_EccKeyToDer (ecc_key *, byte *output, word32 inLen) |
| This function writes a private ECC key to der format. More... | |
| WOLFSSL_API int | wc_EccPublicKeyDecode (const byte *, word32 *, ecc_key *, word32) |
| Decodes an ECC public key from an input buffer. It will parse an ASN sequence to retrieve the ECC key. More... | |
| WOLFSSL_API int | wc_EccPublicKeyToDer (ecc_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. with_AlgCurve is a flag for when to include a header that has the Algorithm and Curve information. More... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API int | wc_GetCTC_HashOID (int type) |
| This function returns the hash OID that corresponds to a hashing type. For example, when given the type: SHA512, this function returns the identifier corresponding to a SHA512 hash, SHA512h. More... | |
| WOLFSSL_API 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... | |
| WOLFSSL_API 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.
| der | pointer to the buffer of the certificate to convert |
| derSz | size of the the certificate to convert |
| output | pointer to the buffer in which to store the pem formatted certificate |
| outSz | size of the buffer in which to store the pem formatted certificate |
| type | the type of certificate to generate. Valid types are: CERT_TYPE, PRIVATEKEY_TYPE, ECC_PRIVATEKEY_TYPE, and CERTREQ_TYPE. |
Example
| WOLFSSL_API 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.
| der | pointer to the buffer of the certificate to convert |
| derSz | size of the the certificate to convert |
| output | pointer to the buffer in which to store the pem formatted certificate |
| outSz | size of the buffer in which to store the pem formatted certificate |
| cipher_inf | Additional cipher information. |
| type | the type of certificate to generate. Valid types are: CERT_TYPE, PRIVATEKEY_TYPE, ECC_PRIVATEKEY_TYPE, and CERTREQ_TYPE. |
Example
| WOLFSSL_API int wc_EccKeyToDer | ( | ecc_key * | , |
| byte * | output, | ||
| word32 | inLen | ||
| ) |
This function writes a private ECC key to der format.
| key | pointer to the buffer containing the input ecc key |
| output | pointer to a buffer in which to store the der formatted key |
| inLen | the length of the buffer in which to store the der formatted key |
Example
| WOLFSSL_API int wc_EccPrivateKeyDecode | ( | const byte * | , |
| word32 * | , | ||
| ecc_key * | , | ||
| word32 | |||
| ) |
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.
| input | pointer to the buffer containing the input private key |
| inOutIdx | pointer to a word32 object containing the index in the buffer at which to start |
| key | pointer to an initialized ecc object, on which to store the decoded private key |
| inSz | size of the input buffer containing the private key |
Example
| WOLFSSL_API int wc_EccPublicKeyDecode | ( | const byte * | , |
| word32 * | , | ||
| ecc_key * | , | ||
| word32 | |||
| ) |
Decodes an ECC public key from an input buffer. It will parse an ASN sequence to retrieve the ECC key.
| input | Buffer containing DER encoded key to decode. |
| inOutIdx | Index to start reading input buffer from. On output, index is set to last position parsed of input buffer. |
| key | Pointer to ecc_key struct to store the public key. |
| inSz | Size of the input buffer. |
Example
| WOLFSSL_API int wc_EccPublicKeyToDer | ( | ecc_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. with_AlgCurve is a flag for when to include a header that has the Algorithm and Curve information.
| key | Pointer to ECC key |
| output | Pointer to output buffer to write to. |
| inLen | Size of buffer. |
| with_AlgCurve | a flag for when to include a header that has the Algorithm and Curve information. |
Example
| WOLFSSL_API 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.
| out | pointer to the buffer where the encoded signature will be written |
| digest | pointer to the digest to use to encode the signature |
| digSz | the length of the buffer containing the digest |
| hashOID | OID identifying the hash type used to generate the signature. Valid options, depending on build configurations, are: SHAh, SHA256h, SHA384h, SHA512h, MD2h, MD5h, DESb, DES3b, CTC_MD5wRSA, CTC_SHAwRSA, CTC_SHA256wRSA, CTC_SHA384wRSA, CTC_SHA512wRSA, CTC_SHAwECDSA, CTC_SHA256wECDSA, CTC_SHA384wECDSA, and CTC_SHA512wECDSA. |
| WOLFSSL_API int wc_GetCTC_HashOID | ( | int | type | ) |
This function returns the hash OID that corresponds to a hashing type. For example, when given the type: SHA512, this function returns the identifier corresponding to a SHA512 hash, SHA512h.
| type | the hash type for which to find the OID. Valid options, depending on build configuration, include: MD2, MD5, SHA, SHA256, SHA512, SHA384, and SHA512. |
Example
| WOLFSSL_API int wc_GetSubjectRaw | ( | byte ** | subjectRaw, |
| Cert * | cert | ||
| ) |
This function gets the raw subject from the certificate structure.
| subjectRaw | pointer-pointer to the raw subject upon successful return |
| cert | pointer to the cert from which to get the raw subject |
Example
| WOLFSSL_API 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.
| cert | pointer to an uninitialized cert structure to initialize |
Example
| WOLFSSL_API int wc_MakeCert | ( | Cert * | , |
| byte * | derBuffer, | ||
| word32 | derSz, | ||
| RsaKey * | , | ||
| ecc_key * | , | ||
| WC_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.
| cert | pointer to an initialized cert structure |
| derBuffer | pointer to the buffer in which to hold the generated cert |
| derSz | size of the buffer in which to store the cert |
| rsaKey | pointer to an RsaKey structure containing the rsa key used to generate the certificate |
| eccKey | pointer to an EccKey structure containing the ecc key used to generate the certificate |
| rng | pointer to the random number generator used to make the cert |
Example
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.
| cert | pointer to an initialized cert structure |
| derBuffer | pointer to the buffer in which to hold the generated certificate request |
| derSz | size of the buffer in which to store the certificate request |
| rsaKey | pointer to an RsaKey structure containing the rsa key used to generate the certificate request |
| eccKey | pointer to an EccKey structure containing the ecc key used to generate the certificate request |
Example
| WOLFSSL_API int wc_MakeNtruCert | ( | Cert * | , |
| byte * | derBuffer, | ||
| word32 | derSz, | ||
| const byte * | ntruKey, | ||
| word16 | keySz, | ||
| WC_RNG * | |||
| ) |
Used to make CA signed certs. Called after the subject information has been entered. This function makes an NTRU Certificate from a cert input. It then writes this cert to derBuffer. It takes in an ntruKey and a rng to generate the certificate. The certificate must be initialized with wc_InitCert before this method is called.
| cert | pointer to an initialized cert structure |
| derBuffer | pointer to the buffer in which to store the generated certificate |
| derSz | size of the buffer in which to store the generated certificate |
| ntruKey | pointer to the key to be used to generate the NTRU certificate |
| keySz | size of the key used to generate the NTRU certificate |
| rng | pointer to the random number generator used to generate the NTRU certificate |
Example
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.
| cert | pointer to the cert to make and sign |
| buffer | pointer to the buffer in which to hold the signed certificate |
| buffSz | size of the buffer in which to store the signed certificate |
| key | pointer to an RsaKey structure containing the rsa key to used to sign the certificate |
| rng | pointer to the random number generator used to generate and sign the certificate |
Example
| WOLFSSL_API 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.
| fileName | path to the file containing a pem certificate to convert to a der certificate |
| derBuf | pointer to a char buffer in which to store the converted certificate |
| derSz | size of the char buffer in which to store the converted certificate |
Example
| WOLFSSL_API 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.
| fileName | Name of the file to load. |
| derBuf | Buffer for DER encoded key. |
| derSz | Size of DER buffer. |
Example
| WOLFSSL_API int wc_PubKeyPemToDer | ( | const unsigned char * | , |
| int | , | ||
| unsigned char * | , | ||
| int | |||
| ) |
Convert a PEM encoded public key to DER. Returns the number of bytes written to the buffer or a negative value for an error.
| pem | PEM encoded key |
| pemSz | Size of pem |
| buff | Pointer to buffer for output. |
| buffSz | Size of buffer. |
Example
| WOLFSSL_API int wc_SetAltNames | ( | Cert * | , |
| const char * | |||
| ) |
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.
| cert | pointer to the cert for which to set the alt names |
| file | path of the file containing the pem formatted certificate |
Example
| WOLFSSL_API int wc_SetAltNamesBuffer | ( | Cert * | , |
| const byte * | , | ||
| int | |||
| ) |
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.
| cert | pointer to the cert for which to set the alternate names |
| der | pointer to the buffer containing the der formatted certificate from which to grab the alternate names |
| derSz | size of the buffer containing the der formatted certificate from which to grab the alternate names |
Example
| WOLFSSL_API int wc_SetAuthKeyId | ( | Cert * | cert, |
| const char * | file | ||
| ) |
Set AKID from certificate file in PEM format.
| cert | Cert struct you want to set the AKID of. |
| file | Buffer containing PEM cert file. |
Example
| WOLFSSL_API int wc_SetAuthKeyIdFromCert | ( | Cert * | cert, |
| const byte * | der, | ||
| int | derSz | ||
| ) |
Set AKID from from DER encoded certificate.
| cert | The Cert struct to write to. |
| der | The DER encoded certificate buffer. |
| derSz | Size of der in bytes. |
Example
Set AKID from either an RSA or ECC public key. note: Only set one of rsakey or eckey, not both.
| cert | Pointer to the certificate to set the SKID. |
| rsakey | Pointer to the RsaKey struct to read from. |
| eckey | Pointer to the ecc_key to read from. |
Example
| WOLFSSL_API 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.
| cert | pointer to an uninitialized certificate information structure. |
Example
| WOLFSSL_API int wc_SetDatesBuffer | ( | Cert * | , |
| const byte * | , | ||
| int | |||
| ) |
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.
| cert | pointer to the cert for which to set the dates |
| der | pointer to the buffer containing the der formatted certificate from which to grab the date range |
| derSz | size of the buffer containing the der formatted certificate from which to grab the date range |
Example
| WOLFSSL_API int wc_SetIssuer | ( | Cert * | , |
| const char * | |||
| ) |
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.
| cert | pointer to the cert for which to set the issuer |
| issuerFile | path of the file containing the pem formatted certificate |
Example
| WOLFSSL_API int wc_SetIssuerBuffer | ( | Cert * | , |
| const byte * | , | ||
| int | |||
| ) |
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.
| cert | pointer to the cert for which to set the issuer |
| der | pointer to the buffer containing the der formatted certificate from which to grab the issuer |
| derSz | size of the buffer containing the der formatted certificate from which to grab the issuer |
Example
| WOLFSSL_API 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.
| cert | pointer to the cert for which to set the raw issuer |
| der | pointer to the buffer containing the der formatted certificate from which to grab the subject |
| derSz | size of the buffer containing the der formatted certificate from which to grab the subject |
Example
| WOLFSSL_API int wc_SetSubject | ( | Cert * | , |
| const char * | |||
| ) |
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.
| cert | pointer to the cert for which to set the issuer |
| subjectFile | path of the file containing the pem formatted certificate |
Example
| WOLFSSL_API int wc_SetSubjectBuffer | ( | Cert * | , |
| const byte * | , | ||
| int | |||
| ) |
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.
| cert | pointer to the cert for which to set the subject |
| der | pointer to the buffer containing the der formatted certificate from which to grab the subject |
| derSz | size of the buffer containing the der formatted certificate from which to grab the subject |
Example
| WOLFSSL_API int wc_SetSubjectKeyId | ( | Cert * | cert, |
| const char * | file | ||
| ) |
Set SKID from public key file in PEM format. Both arguments are required.
| cert | Cert structure to set the SKID of. |
| file | Contains the PEM encoded file. |
Example
| WOLFSSL_API int wc_SetSubjectKeyIdFromNtruPublicKey | ( | Cert * | cert, |
| byte * | ntruKey, | ||
| word16 | ntruKeySz | ||
| ) |
Set SKID from NTRU public key.
| cert | Pointer to a Cert structure to be used. |
| ntruKey | Pointer to the NTRU public key in a byte array. |
| ntruKeySz | Size of the NTRU byte array. |
Example
Set SKID from RSA or ECC public key.
| cert | Pointer to a Cert structure to be used. |
| rsakey | Pointer to an RsaKey structure |
| eckey | Pointer to an ecc_key structure |
Example
| WOLFSSL_API 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.
| cert | pointer to the cert for which to set the raw subject |
| der | pointer to the buffer containing the der formatted certificate from which to grab the subject |
| derSz | size of the buffer containing the der formatted certificate from which to grab the subject |
Example
| WOLFSSL_API int wc_SignCert | ( | int | requestSz, |
| int | sigType, | ||
| byte * | derBuffer, | ||
| word32 | derSz, | ||
| RsaKey * | , | ||
| ecc_key * | , | ||
| WC_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.
| requestSz | the size of the certificate body we’re requesting to have signed |
| sType | Type of signature to create. Valid options are: CTC_MD5wRSA, CTC_SHAwRSA, CTC_SHAwECDSA, CTC_SHA256wECDSA, andCTC_SHA256wRSA |
| buffer | pointer to the buffer containing the certificate to be signed. On success: will hold the newly signed certificate |
| buffSz | the (total) size of the buffer in which to store the newly signed certificate |
| rsaKey | pointer to an RsaKey structure containing the rsa key to used to sign the certificate |
| eccKey | pointer to an EccKey structure containing the ecc key to used to sign the certificate |
| rng | pointer to the random number generator used to sign the certificate |
Example