My Project
Loading...
Searching...
No Matches
pkcs7.h File Reference

Go to the source code of this file.

Data Structures

struct  PKCS7Attrib
 
struct  PKCS7DecodedAttrib
 
struct  PKCS7
 

Typedefs

typedef struct PKCS7Attrib PKCS7Attrib
 
typedef struct PKCS7DecodedAttrib PKCS7DecodedAttrib
 
typedef struct PKCS7State PKCS7State
 
typedef struct Pkcs7Cert Pkcs7Cert
 
typedef struct Pkcs7EncodedRecip Pkcs7EncodedRecip
 
typedef struct PKCS7 PKCS7
 
typedef struct PKCS7 PKCS7_SIGNED
 
typedef struct PKCS7SignerInfo PKCS7SignerInfo
 
typedef int(* CallbackOriDecrypt) (PKCS7 *pkcs7, byte *oriType, word32 oriTypeSz, byte *oriValue, word32 oriValueSz, byte *decryptedKey, word32 *decryptedKeySz, void *ctx)
 
typedef int(* CallbackOriEncrypt) (PKCS7 *pkcs7, byte *cek, word32 cekSz, byte *oriType, word32 *oriTypeSz, byte *oriValue, word32 *oriValueSz, void *ctx)
 
typedef int(* CallbackDecryptContent) (PKCS7 *pkcs7, int encryptOID, byte *iv, int ivSz, byte *aad, word32 aadSz, byte *authTag, word32 authTagSz, byte *in, int inSz, byte *out, void *ctx)
 
typedef int(* CallbackWrapCEK) (PKCS7 *pkcs7, byte *cek, word32 cekSz, byte *keyId, word32 keyIdSz, byte *originKey, word32 originKeySz, byte *out, word32 outSz, int keyWrapAlgo, int type, int dir)
 
typedef int(* CallbackRsaSignRawDigest) (PKCS7 *pkcs7, byte *digest, word32 digestSz, byte *out, word32 outSz, byte *privateKey, word32 privateKeySz, int devId, int hashOID)
 

Enumerations

enum  PKCS7_STATE {
  WC_PKCS7_START = 0 , WC_PKCS7_STAGE2 , WC_PKCS7_STAGE3 , WC_PKCS7_STAGE4 ,
  WC_PKCS7_STAGE5 , WC_PKCS7_STAGE6 , WC_PKCS7_VERIFY_STAGE2 , WC_PKCS7_VERIFY_STAGE3 ,
  WC_PKCS7_VERIFY_STAGE4 , WC_PKCS7_VERIFY_STAGE5 , WC_PKCS7_VERIFY_STAGE6 , WC_PKCS7_INFOSET_START ,
  WC_PKCS7_INFOSET_BER , WC_PKCS7_INFOSET_STAGE1 , WC_PKCS7_INFOSET_STAGE2 , WC_PKCS7_INFOSET_END ,
  WC_PKCS7_ENV_2 , WC_PKCS7_ENV_3 , WC_PKCS7_ENV_4 , WC_PKCS7_ENV_5 ,
  WC_PKCS7_AUTHENV_2 , WC_PKCS7_AUTHENV_3 , WC_PKCS7_AUTHENV_4 , WC_PKCS7_AUTHENV_5 ,
  WC_PKCS7_AUTHENV_6 , WC_PKCS7_AUTHENV_ATRB , WC_PKCS7_AUTHENV_ATRBEND , WC_PKCS7_AUTHENV_7 ,
  WC_PKCS7_DECRYPT_KTRI , WC_PKCS7_DECRYPT_KTRI_2 , WC_PKCS7_DECRYPT_KTRI_3 , WC_PKCS7_DECRYPT_KARI ,
  WC_PKCS7_DECRYPT_KEKRI , WC_PKCS7_DECRYPT_PWRI , WC_PKCS7_DECRYPT_ORI , WC_PKCS7_DECRYPT_DONE
}
 
enum  Pkcs7_Misc {
  PKCS7_NONCE_SZ = 16 , MAX_ENCRYPTED_KEY_SZ = 512 , MAX_CONTENT_KEY_LEN = 32 , MAX_CONTENT_IV_SIZE = 16 ,
  MAX_CONTENT_BLOCK_LEN = AES_BLOCK_SIZE , MAX_CONTENT_BLOCK_LEN = AES_BLOCK_SIZE , MAX_RECIP_SZ , GCM_NONCE_MID_SZ = 12 ,
  CCM_NONCE_MIN_SZ = 7
}
 
enum  Cms_Options { CMS_SKID = 1 , CMS_ISSUER_AND_SERIAL_NUMBER = 2 }
 
enum  Pkcs7_RecipientInfo_Types {
  PKCS7_KTRI = 0 , PKCS7_KARI = 1 , PKCS7_KEKRI = 2 , PKCS7_PWRI = 3 ,
  PKCS7_ORI = 4
}
 

Functions

WOLFSSL_API PKCS7wc_PKCS7_New (void *heap, int devId)
 
WOLFSSL_API int wc_PKCS7_Init (PKCS7 *pkcs7, void *heap, int devId)
 
WOLFSSL_API int wc_PKCS7_InitWithCert (PKCS7 *pkcs7, byte *der, word32 derSz)
 This function initializes a PKCS7 structure with a DER-formatted certificate. To initialize an empty PKCS7 structure, one can pass in a NULL cert and 0 for certSz.
 
WOLFSSL_API int wc_PKCS7_AddCertificate (PKCS7 *pkcs7, byte *der, word32 derSz)
 
WOLFSSL_API void wc_PKCS7_Free (PKCS7 *pkcs7)
 This function releases any memory allocated by a PKCS7 initializer.
 
WOLFSSL_API int wc_PKCS7_GetAttributeValue (PKCS7 *pkcs7, const byte *oid, word32 oidSz, byte *out, word32 *outSz)
 
WOLFSSL_API int wc_PKCS7_SetSignerIdentifierType (PKCS7 *pkcs7, int type)
 
WOLFSSL_API int wc_PKCS7_SetContentType (PKCS7 *pkcs7, byte *contentType, word32 sz)
 
WOLFSSL_API int wc_PKCS7_GetPadSize (word32 inputSz, word32 blockSz)
 
WOLFSSL_API int wc_PKCS7_PadData (byte *in, word32 inSz, byte *out, word32 outSz, word32 blockSz)
 
WOLFSSL_API int wc_PKCS7_EncodeData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 This function builds the PKCS7 data content type, encoding the PKCS7 structure into a buffer containing a parsable PKCS7 data packet.
 
WOLFSSL_API int wc_PKCS7_SetDetached (PKCS7 *pkcs7, word16 flag)
 
WOLFSSL_API int wc_PKCS7_NoDefaultSignedAttribs (PKCS7 *pkcs7)
 
WOLFSSL_API int wc_PKCS7_EncodeSignedData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 This function builds the PKCS7 signed data content type, encoding the PKCS7 structure into a buffer containing a parsable PKCS7 signed data packet.
 
WOLFSSL_API int wc_PKCS7_EncodeSignedData_ex (PKCS7 *pkcs7, const byte *hashBuf, word32 hashSz, byte *outputHead, word32 *outputHeadSz, byte *outputFoot, word32 *outputFootSz)
 This function builds the PKCS7 signed data content type, encoding the PKCS7 structure into a header and footer buffer containing a parsable PKCS7 signed data packet. This does not include the content. A hash must be computed and provided for the data.
 
WOLFSSL_API void wc_PKCS7_AllowDegenerate (PKCS7 *pkcs7, word16 flag)
 
WOLFSSL_API int wc_PKCS7_VerifySignedData (PKCS7 *pkcs7, byte *pkiMsg, word32 pkiMsgSz)
 This function takes in a transmitted PKCS7 signed data message, extracts the certificate list and certificate revocation list, and then verifies the signature. It stores the extracted content in the given PKCS7 structure.
 
WOLFSSL_API int wc_PKCS7_VerifySignedData_ex (PKCS7 *pkcs7, const byte *hashBuf, word32 hashSz, byte *pkiMsgHead, word32 pkiMsgHeadSz, byte *pkiMsgFoot, word32 pkiMsgFootSz)
 This function takes in a transmitted PKCS7 signed data message as hash/header/footer, then extracts the certificate list and certificate revocation list, and then verifies the signature. It stores the extracted content in the given PKCS7 structure.
 
WOLFSSL_API int wc_PKCS7_GetSignerSID (PKCS7 *pkcs7, byte *out, word32 *outSz)
 
WOLFSSL_API int wc_PKCS7_EncodeSignedFPD (PKCS7 *pkcs7, byte *privateKey, word32 privateKeySz, int signOID, int hashOID, byte *content, word32 contentSz, PKCS7Attrib *signedAttribs, word32 signedAttribsSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_EncodeSignedEncryptedFPD (PKCS7 *pkcs7, byte *encryptKey, word32 encryptKeySz, byte *privateKey, word32 privateKeySz, int encryptOID, int signOID, int hashOID, byte *content, word32 contentSz, PKCS7Attrib *unprotectedAttribs, word32 unprotectedAttribsSz, PKCS7Attrib *signedAttribs, word32 signedAttribsSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_EncodeSignedCompressedFPD (PKCS7 *pkcs7, byte *privateKey, word32 privateKeySz, int signOID, int hashOID, byte *content, word32 contentSz, PKCS7Attrib *signedAttribs, word32 signedAttribsSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_EncodeSignedEncryptedCompressedFPD (PKCS7 *pkcs7, byte *encryptKey, word32 encryptKeySz, byte *privateKey, word32 privateKeySz, int encryptOID, int signOID, int hashOID, byte *content, word32 contentSz, PKCS7Attrib *unprotectedAttribs, word32 unprotectedAttribsSz, PKCS7Attrib *signedAttribs, word32 signedAttribsSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_AddRecipient_KTRI (PKCS7 *pkcs7, const byte *cert, word32 certSz, int options)
 
WOLFSSL_API int wc_PKCS7_AddRecipient_KARI (PKCS7 *pkcs7, const byte *cert, word32 certSz, int keyWrapOID, int keyAgreeOID, byte *ukm, word32 ukmSz, int options)
 
WOLFSSL_API int wc_PKCS7_SetKey (PKCS7 *pkcs7, byte *key, word32 keySz)
 
WOLFSSL_API int wc_PKCS7_AddRecipient_KEKRI (PKCS7 *pkcs7, int keyWrapOID, byte *kek, word32 kekSz, byte *keyID, word32 keyIdSz, void *timePtr, byte *otherOID, word32 otherOIDSz, byte *other, word32 otherSz, int options)
 
WOLFSSL_API int wc_PKCS7_SetPassword (PKCS7 *pkcs7, byte *passwd, word32 pLen)
 
WOLFSSL_API int wc_PKCS7_AddRecipient_PWRI (PKCS7 *pkcs7, byte *passwd, word32 pLen, byte *salt, word32 saltSz, int kdfOID, int prfOID, int iterations, int kekEncryptOID, int options)
 
WOLFSSL_API int wc_PKCS7_SetOriEncryptCtx (PKCS7 *pkcs7, void *ctx)
 
WOLFSSL_API int wc_PKCS7_SetOriDecryptCtx (PKCS7 *pkcs7, void *ctx)
 
WOLFSSL_API int wc_PKCS7_SetOriDecryptCb (PKCS7 *pkcs7, CallbackOriDecrypt cb)
 
WOLFSSL_API int wc_PKCS7_AddRecipient_ORI (PKCS7 *pkcs7, CallbackOriEncrypt cb, int options)
 
WOLFSSL_API int wc_PKCS7_SetWrapCEKCb (PKCS7 *pkcs7, CallbackWrapCEK wrapCEKCb)
 
WOLFSSL_API int wc_PKCS7_SetRsaSignRawDigestCb (PKCS7 *pkcs7, CallbackRsaSignRawDigest cb)
 
WOLFSSL_API int wc_PKCS7_EncodeEnvelopedData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 This function builds the PKCS7 enveloped data content type, encoding the PKCS7 structure into a buffer containing a parsable PKCS7 enveloped data packet.
 
WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData (PKCS7 *pkcs7, byte *pkiMsg, word32 pkiMsgSz, byte *output, word32 outputSz)
 This function unwraps and decrypts a PKCS7 enveloped data content type, decoding the message into output. It uses the private key of the PKCS7 object passed in to decrypt the message.
 
WOLFSSL_API int wc_PKCS7_EncodeAuthEnvelopedData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_DecodeAuthEnvelopedData (PKCS7 *pkcs7, byte *pkiMsg, word32 pkiMsgSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_EncodeEncryptedData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_DecodeEncryptedData (PKCS7 *pkcs7, byte *pkiMsg, word32 pkiMsgSz, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_SetDecodeEncryptedCb (PKCS7 *pkcs7, CallbackDecryptContent decryptionCb)
 
WOLFSSL_API int wc_PKCS7_SetDecodeEncryptedCtx (PKCS7 *pkcs7, void *ctx)
 
WOLFSSL_API int wc_PKCS7_EncodeCompressedData (PKCS7 *pkcs7, byte *output, word32 outputSz)
 
WOLFSSL_API int wc_PKCS7_DecodeCompressedData (PKCS7 *pkcs7, byte *pkiMsg, word32 pkiMsgSz, byte *output, word32 outputSz)
 

Variables

 C