forked from wolfSSL/wolfssl
pack PKCS7 structure
This commit is contained in:
@@ -16464,13 +16464,13 @@ int pkcs7encrypted_test(void)
|
|||||||
|
|
||||||
PKCS7Attrib attribs[] =
|
PKCS7Attrib attribs[] =
|
||||||
{
|
{
|
||||||
{ genAttrOid, sizeof(genAttrOid), genAttr, sizeof(genAttr) }
|
{ genAttrOid, genAttr, sizeof(genAttrOid), sizeof(genAttr) }
|
||||||
};
|
};
|
||||||
|
|
||||||
PKCS7Attrib multiAttribs[] =
|
PKCS7Attrib multiAttribs[] =
|
||||||
{
|
{
|
||||||
{ genAttrOid, sizeof(genAttrOid), genAttr, sizeof(genAttr) },
|
{ genAttrOid, genAttr, sizeof(genAttrOid), sizeof(genAttr) },
|
||||||
{ genAttrOid2, sizeof(genAttrOid2), genAttr2, sizeof(genAttr2) }
|
{ genAttrOid2, genAttr2, sizeof(genAttrOid2), sizeof(genAttr2) }
|
||||||
};
|
};
|
||||||
#endif /* NO_AES */
|
#endif /* NO_AES */
|
||||||
|
|
||||||
@@ -16638,12 +16638,12 @@ static int pkcs7signed_run_vectors(byte* rsaCert, word32 rsaCertSz,
|
|||||||
|
|
||||||
PKCS7Attrib attribs[] =
|
PKCS7Attrib attribs[] =
|
||||||
{
|
{
|
||||||
{ transIdOid, sizeof(transIdOid),
|
{ transIdOid, transId, sizeof(transIdOid),
|
||||||
transId, sizeof(transId) - 1 }, /* take off the null */
|
sizeof(transId) - 1 }, /* take off the null */
|
||||||
{ messageTypeOid, sizeof(messageTypeOid),
|
{ messageTypeOid, messageType, sizeof(messageTypeOid),
|
||||||
messageType, sizeof(messageType) },
|
sizeof(messageType) },
|
||||||
{ senderNonceOid, sizeof(senderNonceOid),
|
{ senderNonceOid, senderNonce, sizeof(senderNonceOid),
|
||||||
senderNonce, sizeof(senderNonce) }
|
sizeof(senderNonce) }
|
||||||
};
|
};
|
||||||
|
|
||||||
const pkcs7SignedVector testVectors[] =
|
const pkcs7SignedVector testVectors[] =
|
||||||
|
@@ -77,63 +77,60 @@ enum Pkcs7_Misc {
|
|||||||
|
|
||||||
typedef struct PKCS7Attrib {
|
typedef struct PKCS7Attrib {
|
||||||
byte* oid;
|
byte* oid;
|
||||||
word32 oidSz;
|
|
||||||
byte* value;
|
byte* value;
|
||||||
|
word32 oidSz;
|
||||||
word32 valueSz;
|
word32 valueSz;
|
||||||
} PKCS7Attrib;
|
} PKCS7Attrib;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PKCS7DecodedAttrib {
|
typedef struct PKCS7DecodedAttrib {
|
||||||
byte* oid;
|
|
||||||
word32 oidSz;
|
|
||||||
byte* value;
|
|
||||||
word32 valueSz;
|
|
||||||
struct PKCS7DecodedAttrib* next;
|
struct PKCS7DecodedAttrib* next;
|
||||||
|
byte* oid;
|
||||||
|
byte* value;
|
||||||
|
word32 oidSz;
|
||||||
|
word32 valueSz;
|
||||||
} PKCS7DecodedAttrib;
|
} PKCS7DecodedAttrib;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PKCS7 {
|
typedef struct PKCS7 {
|
||||||
byte* content; /* inner content, not owner */
|
byte issuerHash[KEYID_SIZE]; /* hash of all alt Names */
|
||||||
word32 contentSz; /* content size */
|
byte issuerSn[MAX_SN_SZ]; /* singleCert's serial number */
|
||||||
int contentOID; /* PKCS#7 content type OID sum */
|
byte publicKey[MAX_RSA_INT_SZ + MAX_RSA_E_SZ ];/*MAX RSA key size (m + e)*/
|
||||||
|
word32 certSz[MAX_PKCS7_CERTS];
|
||||||
WC_RNG* rng;
|
WC_RNG* rng;
|
||||||
|
PKCS7Attrib* signedAttribs;
|
||||||
int hashOID;
|
byte* content; /* inner content, not owner */
|
||||||
int encryptOID; /* key encryption algorithm OID */
|
byte* singleCert; /* recipient cert, DER, not owner */
|
||||||
int keyWrapOID; /* key wrap algorithm OID */
|
byte* issuer; /* issuer name of singleCert */
|
||||||
int keyAgreeOID; /* key agreement algorithm OID */
|
byte* privateKey; /* private key, DER, not owner */
|
||||||
|
|
||||||
void* heap; /* heap hint for dynamic memory */
|
void* heap; /* heap hint for dynamic memory */
|
||||||
byte* cert[MAX_PKCS7_CERTS];
|
byte* cert[MAX_PKCS7_CERTS];
|
||||||
word32 certSz[MAX_PKCS7_CERTS];
|
|
||||||
byte* singleCert; /* recipient cert, DER, not owner */
|
|
||||||
word32 singleCertSz; /* size of recipient cert buffer, bytes */
|
|
||||||
byte issuerHash[KEYID_SIZE]; /* hash of all alt Names */
|
|
||||||
byte* issuer; /* issuer name of singleCert */
|
|
||||||
word32 issuerSz; /* length of issuer name */
|
|
||||||
byte issuerSn[MAX_SN_SZ]; /* singleCert's serial number */
|
|
||||||
word32 issuerSnSz; /* length of serial number */
|
|
||||||
|
|
||||||
byte publicKey[MAX_RSA_INT_SZ + MAX_RSA_E_SZ ];/*MAX RSA key size (m + e)*/
|
/* Encrypted-data Content Type */
|
||||||
word32 publicKeySz;
|
byte* encryptionKey; /* block cipher encryption key */
|
||||||
word32 publicKeyOID; /* key OID (RSAk, ECDSAk, etc) */
|
PKCS7Attrib* unprotectedAttribs; /* optional */
|
||||||
byte* privateKey; /* private key, DER, not owner */
|
PKCS7DecodedAttrib* decodedAttrib; /* linked list of decoded attribs */
|
||||||
word32 privateKeySz; /* size of private key buffer, bytes */
|
|
||||||
|
|
||||||
PKCS7Attrib* signedAttribs;
|
|
||||||
word32 signedAttribsSz;
|
|
||||||
|
|
||||||
/* Enveloped-data optional ukm, not owner */
|
/* Enveloped-data optional ukm, not owner */
|
||||||
byte* ukm;
|
byte* ukm;
|
||||||
word32 ukmSz;
|
word32 ukmSz;
|
||||||
|
|
||||||
/* Encrypted-data Content Type */
|
|
||||||
byte* encryptionKey; /* block cipher encryption key */
|
|
||||||
word32 encryptionKeySz; /* size of key buffer, bytes */
|
word32 encryptionKeySz; /* size of key buffer, bytes */
|
||||||
PKCS7Attrib* unprotectedAttribs; /* optional */
|
|
||||||
word32 unprotectedAttribsSz;
|
word32 unprotectedAttribsSz;
|
||||||
PKCS7DecodedAttrib* decodedAttrib; /* linked list of decoded attribs */
|
word32 contentSz; /* content size */
|
||||||
|
word32 singleCertSz; /* size of recipient cert buffer, bytes */
|
||||||
|
word32 issuerSz; /* length of issuer name */
|
||||||
|
word32 issuerSnSz; /* length of serial number */
|
||||||
|
|
||||||
|
word32 publicKeySz;
|
||||||
|
word32 publicKeyOID; /* key OID (RSAk, ECDSAk, etc) */
|
||||||
|
word32 privateKeySz; /* size of private key buffer, bytes */
|
||||||
|
word32 signedAttribsSz;
|
||||||
|
int contentOID; /* PKCS#7 content type OID sum */
|
||||||
|
int hashOID;
|
||||||
|
int encryptOID; /* key encryption algorithm OID */
|
||||||
|
int keyWrapOID; /* key wrap algorithm OID */
|
||||||
|
int keyAgreeOID; /* key agreement algorithm OID */
|
||||||
} PKCS7;
|
} PKCS7;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user