mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 07:17:32 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -27,8 +27,6 @@ include $(CORE_DEPTH)/coreconf/config.mk
|
|||
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
|
||||
#######################################################################
|
||||
|
||||
include config.mk
|
||||
|
||||
#######################################################################
|
||||
# (5) Execute "global" rules. (OPTIONAL) #
|
||||
#######################################################################
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#
|
||||
# Override TARGETS variable so that only static libraries
|
||||
# are specifed as dependencies within rules.mk.
|
||||
#
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
SHARED_LIBRARY =
|
||||
IMPORT_LIBRARY =
|
||||
PROGRAM =
|
||||
|
||||
|
|
@ -26,6 +26,7 @@ CSRCS = \
|
|||
$(NULL)
|
||||
|
||||
LIBRARY_NAME = pkcs12
|
||||
SHARED_LIBRARY = $(NULL)
|
||||
|
||||
# This part of the code, including all sub-dirs, can be optimized for size
|
||||
export ALLOW_OPT_CODE_SIZE = 1
|
||||
|
|
|
|||
|
|
@ -337,11 +337,7 @@ sec_pkcs12_decoder_safe_bag_update(void *arg, const char *data,
|
|||
SEC_PKCS12DecoderContext *p12dcx;
|
||||
SECStatus rv;
|
||||
|
||||
/* make sure that we are not skipping the current safeBag,
|
||||
* and that there are no errors. If so, just return rather
|
||||
* than continuing to process.
|
||||
*/
|
||||
if (!safeContentsCtx || !safeContentsCtx->p12dcx || safeContentsCtx->skipCurrentSafeBag) {
|
||||
if (!safeContentsCtx || !safeContentsCtx->p12dcx || !safeContentsCtx->currentSafeBagA1Dcx) {
|
||||
return;
|
||||
}
|
||||
p12dcx = safeContentsCtx->p12dcx;
|
||||
|
|
@ -1365,32 +1361,10 @@ sec_pkcs12_decoder_verify_mac(SEC_PKCS12DecoderContext *p12dcx)
|
|||
iteration);
|
||||
|
||||
algtag = SECOID_GetAlgorithmTag(&p12dcx->macData.safeMac.digestAlgorithm);
|
||||
switch (algtag) {
|
||||
case SEC_OID_SHA1:
|
||||
integrityMech = CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD5:
|
||||
integrityMech = CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD2:
|
||||
integrityMech = CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA224:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA224_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA256:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA256_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA384:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA384_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA512:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA512_HMAC_KEY_GEN;
|
||||
break;
|
||||
default:
|
||||
goto loser;
|
||||
integrityMech = sec_pkcs12_algtag_to_keygen_mech(algtag);
|
||||
if (integrityMech == CKM_INVALID_MECHANISM) {
|
||||
goto loser;
|
||||
}
|
||||
|
||||
symKey = PK11_KeyGen(NULL, integrityMech, params, 0, NULL);
|
||||
PK11_DestroyPBEParams(params);
|
||||
params = NULL;
|
||||
|
|
@ -2804,7 +2778,7 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
SEC_PKCS12NicknameCollisionCallback nicknameCb)
|
||||
{
|
||||
SECStatus rv;
|
||||
int i, noInstallCnt, probCnt, bagCnt, errorVal = 0;
|
||||
int i, probCnt, errorVal = 0;
|
||||
if (!p12dcx || p12dcx->error || !p12dcx->safeBags) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
return SECFailure;
|
||||
|
|
@ -2815,12 +2789,9 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
p12dcx->bagsVerified = PR_TRUE;
|
||||
}
|
||||
|
||||
noInstallCnt = probCnt = bagCnt = 0;
|
||||
probCnt = 0;
|
||||
i = 0;
|
||||
while (p12dcx->safeBags[i]) {
|
||||
bagCnt++;
|
||||
if (p12dcx->safeBags[i]->noInstall)
|
||||
noInstallCnt++;
|
||||
if (p12dcx->safeBags[i]->problem) {
|
||||
probCnt++;
|
||||
errorVal = p12dcx->safeBags[i]->error;
|
||||
|
|
@ -2828,15 +2799,6 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
i++;
|
||||
}
|
||||
|
||||
/* formerly was erroneous code here that assumed that if all bags
|
||||
* failed to import, then the problem was duplicated data;
|
||||
* that is, it assume that the problem must be that the file had
|
||||
* previously been successfully imported. But importing a
|
||||
* previously imported file causes NO ERRORS at all, and this
|
||||
* false assumption caused real errors to be hidden behind false
|
||||
* errors about duplicated data.
|
||||
*/
|
||||
|
||||
if (probCnt) {
|
||||
PORT_SetError(errorVal);
|
||||
return SECFailure;
|
||||
|
|
@ -3416,8 +3378,7 @@ sec_pkcs12_decoder_create_cert(SEC_PKCS12DecoderContext *p12dcx,
|
|||
|
||||
oid = SECOID_FindOIDByTag(SEC_OID_PKCS12_V1_CERT_BAG_ID);
|
||||
certBag = PORT_ArenaZNew(p12dcx->arena, sec_PKCS12SafeBag);
|
||||
if (!certBag || !oid || (SECITEM_CopyItem(p12dcx->arena,
|
||||
&certBag->safeBagType, &oid->oid) != SECSuccess)) {
|
||||
if (!certBag || !oid || (SECITEM_CopyItem(p12dcx->arena, &certBag->safeBagType, &oid->oid) != SECSuccess)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "secpkcs7.h"
|
||||
#include "secasn1.h"
|
||||
#include "secerr.h"
|
||||
#include "sechash.h"
|
||||
#include "pk11func.h"
|
||||
#include "p12plcy.h"
|
||||
#include "p12local.h"
|
||||
|
|
@ -379,11 +380,18 @@ SEC_PKCS12CreatePasswordPrivSafe(SEC_PKCS12ExportContext *p12ctxt,
|
|||
safeInfo->itemCount = 0;
|
||||
|
||||
/* create the encrypted safe */
|
||||
if (!SEC_PKCS5IsAlgorithmPBEAlgTag(privAlg) &&
|
||||
PK11_AlgtagToMechanism(privAlg) == CKM_AES_CBC) {
|
||||
if (!SEC_PKCS5IsAlgorithmPBEAlgTag(privAlg)) {
|
||||
SECOidTag prfAlg = SEC_OID_UNKNOWN;
|
||||
/* if we have password integrity set, use that to set the integrity
|
||||
* hash algorithm to set our password PRF. If we haven't set it, just
|
||||
* let the low level code pick it */
|
||||
if (p12ctxt->integrityEnabled && p12ctxt->pwdIntegrity) {
|
||||
prfAlg = HASH_GetHMACOidTagByHashOidTag(
|
||||
p12ctxt->integrityInfo.pwdInfo.algorithm);
|
||||
}
|
||||
safeInfo->cinfo = SEC_PKCS7CreateEncryptedDataWithPBEV2(SEC_OID_PKCS5_PBES2,
|
||||
privAlg,
|
||||
SEC_OID_UNKNOWN,
|
||||
prfAlg,
|
||||
0,
|
||||
p12ctxt->pwfn,
|
||||
p12ctxt->pwfnarg);
|
||||
|
|
@ -1213,6 +1221,7 @@ SEC_PKCS12AddKeyForCert(SEC_PKCS12ExportContext *p12ctxt, SEC_PKCS12SafeInfo *sa
|
|||
/* extract the key encrypted */
|
||||
SECKEYEncryptedPrivateKeyInfo *epki = NULL;
|
||||
PK11SlotInfo *slot = NULL;
|
||||
SECOidTag prfAlg = SEC_OID_UNKNOWN;
|
||||
|
||||
if (!sec_pkcs12_encode_password(p12ctxt->arena, &uniPwitem, algorithm,
|
||||
pwitem)) {
|
||||
|
|
@ -1220,6 +1229,14 @@ SEC_PKCS12AddKeyForCert(SEC_PKCS12ExportContext *p12ctxt, SEC_PKCS12SafeInfo *sa
|
|||
goto loser;
|
||||
}
|
||||
|
||||
/* if we have password integrity set, use that to set the integrity
|
||||
* hash algorithm to set our password PRF. If we haven't set it, just
|
||||
* let the low level code pick it */
|
||||
if (p12ctxt->integrityEnabled && p12ctxt->pwdIntegrity) {
|
||||
prfAlg = HASH_GetHMACOidTagByHashOidTag(
|
||||
p12ctxt->integrityInfo.pwdInfo.algorithm);
|
||||
}
|
||||
|
||||
/* we want to make sure to take the key out of the key slot */
|
||||
if (PK11_IsInternal(p12ctxt->slot)) {
|
||||
slot = PK11_GetInternalKeySlot();
|
||||
|
|
@ -1227,10 +1244,15 @@ SEC_PKCS12AddKeyForCert(SEC_PKCS12ExportContext *p12ctxt, SEC_PKCS12SafeInfo *sa
|
|||
slot = PK11_ReferenceSlot(p12ctxt->slot);
|
||||
}
|
||||
|
||||
epki = PK11_ExportEncryptedPrivateKeyInfo(slot, algorithm,
|
||||
&uniPwitem, cert,
|
||||
NSS_PBE_DEFAULT_ITERATION_COUNT,
|
||||
p12ctxt->wincx);
|
||||
/* passing algorithm as the pbe will force the PBE code to
|
||||
* automatically handle the selection between using the algorithm
|
||||
* as a the pbe algorithm, or using the algorithm as a cipher
|
||||
* and building a pkcs5 pbe */
|
||||
epki = PK11_ExportEncryptedPrivateKeyInfoV2(slot, algorithm,
|
||||
SEC_OID_UNKNOWN, prfAlg,
|
||||
&uniPwitem, cert,
|
||||
NSS_PBE_DEFAULT_ITERATION_COUNT,
|
||||
p12ctxt->wincx);
|
||||
PK11_FreeSlot(slot);
|
||||
if (!epki) {
|
||||
PORT_SetError(SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY);
|
||||
|
|
@ -1595,18 +1617,10 @@ sec_pkcs12_encoder_start_context(SEC_PKCS12ExportContext *p12exp)
|
|||
SECITEM_ZfreeItem(&pwd, PR_FALSE);
|
||||
|
||||
/* get the PBA Mechanism to generate the key */
|
||||
switch (p12exp->integrityInfo.pwdInfo.algorithm) {
|
||||
case SEC_OID_SHA1:
|
||||
integrityMechType = CKM_PBA_SHA1_WITH_SHA1_HMAC;
|
||||
break;
|
||||
case SEC_OID_MD5:
|
||||
integrityMechType = CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD2:
|
||||
integrityMechType = CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN;
|
||||
break;
|
||||
default:
|
||||
goto loser;
|
||||
integrityMechType = sec_pkcs12_algtag_to_keygen_mech(
|
||||
p12exp->integrityInfo.pwdInfo.algorithm);
|
||||
if (integrityMechType == CKM_INVALID_MECHANISM) {
|
||||
goto loser;
|
||||
}
|
||||
|
||||
/* generate the key */
|
||||
|
|
@ -1837,7 +1851,8 @@ loser:
|
|||
static SECStatus
|
||||
sec_Pkcs12FinishMac(sec_PKCS12EncoderContext *p12ecx)
|
||||
{
|
||||
SECItem hmac = { siBuffer, NULL, 0 };
|
||||
unsigned char hmacData[HASH_LENGTH_MAX];
|
||||
unsigned int hmacLen;
|
||||
SECStatus rv;
|
||||
SGNDigestInfo *di = NULL;
|
||||
void *dummy;
|
||||
|
|
@ -1856,13 +1871,8 @@ sec_Pkcs12FinishMac(sec_PKCS12EncoderContext *p12ecx)
|
|||
}
|
||||
|
||||
/* finish the hmac */
|
||||
hmac.data = (unsigned char *)PORT_ZAlloc(SHA1_LENGTH);
|
||||
if (!hmac.data) {
|
||||
PORT_SetError(SEC_ERROR_NO_MEMORY);
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
rv = PK11_DigestFinal(p12ecx->hmacCx, hmac.data, &hmac.len, SHA1_LENGTH);
|
||||
rv = PK11_DigestFinal(p12ecx->hmacCx, hmacData, &hmacLen, HASH_LENGTH_MAX);
|
||||
|
||||
if (rv != SECSuccess) {
|
||||
PORT_SetError(SEC_ERROR_NO_MEMORY);
|
||||
|
|
@ -1871,7 +1881,7 @@ sec_Pkcs12FinishMac(sec_PKCS12EncoderContext *p12ecx)
|
|||
|
||||
/* create the digest info */
|
||||
di = SGN_CreateDigestInfo(p12ecx->p12exp->integrityInfo.pwdInfo.algorithm,
|
||||
hmac.data, hmac.len);
|
||||
hmacData, hmacLen);
|
||||
if (!di) {
|
||||
PORT_SetError(SEC_ERROR_NO_MEMORY);
|
||||
rv = SECFailure;
|
||||
|
|
@ -1896,11 +1906,9 @@ loser:
|
|||
if (di) {
|
||||
SGN_DestroyDigestInfo(di);
|
||||
}
|
||||
if (hmac.data) {
|
||||
SECITEM_ZfreeItem(&hmac, PR_FALSE);
|
||||
}
|
||||
PK11_DestroyContext(p12ecx->hmacCx, PR_TRUE);
|
||||
p12ecx->hmacCx = NULL;
|
||||
PORT_Memset(hmacData, 0, hmacLen);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,37 @@ sec_pkcs12_algtag_to_mech(SECOidTag algtag)
|
|||
return CKM_INVALID_MECHANISM;
|
||||
}
|
||||
|
||||
CK_MECHANISM_TYPE
|
||||
sec_pkcs12_algtag_to_keygen_mech(SECOidTag algtag)
|
||||
{
|
||||
switch (algtag) {
|
||||
case SEC_OID_SHA1:
|
||||
return CKM_NSS_PBE_SHA1_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD5:
|
||||
return CKM_NSS_PBE_MD5_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD2:
|
||||
return CKM_NSS_PBE_MD2_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA224:
|
||||
return CKM_NSS_PKCS12_PBE_SHA224_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA256:
|
||||
return CKM_NSS_PKCS12_PBE_SHA256_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA384:
|
||||
return CKM_NSS_PKCS12_PBE_SHA384_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA512:
|
||||
return CKM_NSS_PKCS12_PBE_SHA512_HMAC_KEY_GEN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return CKM_INVALID_MECHANISM;
|
||||
}
|
||||
|
||||
/* helper functions */
|
||||
/* returns proper bag type template based upon object type tag */
|
||||
const SEC_ASN1Template *
|
||||
|
|
@ -877,8 +908,12 @@ sec_pkcs12_find_object(SEC_PKCS12SafeContents *safe,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* this function converts a password to unicode and encures that the
|
||||
* required double 0 byte be placed at the end of the string
|
||||
/* this function converts a password to UCS2 and ensures that the
|
||||
* required double 0 byte be placed at the end of the string (if zeroTerm
|
||||
* is set), or the 0 bytes at the end are dropped (if zeroTerm is not set).
|
||||
* If toUnicode is false, we convert from UCS2 to UTF8/ASCII (latter is a
|
||||
* proper subset of the former) depending on the state of the asciiCovert
|
||||
* flag)
|
||||
*/
|
||||
PRBool
|
||||
sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest,
|
||||
|
|
@ -886,12 +921,15 @@ sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest,
|
|||
PRBool asciiConvert, PRBool toUnicode)
|
||||
{
|
||||
PRBool success = PR_FALSE;
|
||||
int bufferSize;
|
||||
|
||||
if (!src || !dest) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
dest->len = src->len * 3 + 2;
|
||||
bufferSize = src->len * 3 + 2;
|
||||
dest->len = bufferSize;
|
||||
if (arena) {
|
||||
dest->data = (unsigned char *)PORT_ArenaZAlloc(arena, dest->len);
|
||||
} else {
|
||||
|
|
@ -925,24 +963,35 @@ sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if ((dest->len >= 2) &&
|
||||
(dest->data[dest->len - 1] || dest->data[dest->len - 2]) && zeroTerm) {
|
||||
if (dest->len + 2 > 3 * src->len) {
|
||||
if (arena) {
|
||||
dest->data = (unsigned char *)PORT_ArenaGrow(arena,
|
||||
dest->data, dest->len,
|
||||
dest->len + 2);
|
||||
} else {
|
||||
dest->data = (unsigned char *)PORT_Realloc(dest->data,
|
||||
dest->len + 2);
|
||||
/* in some cases we need to add NULL terminations and in others
|
||||
* we need to drop null terminations */
|
||||
if (zeroTerm) {
|
||||
/* unicode adds two nulls at the end */
|
||||
if (toUnicode) {
|
||||
if ((dest->len < 2) || dest->data[dest->len - 1] || dest->data[dest->len - 2]) {
|
||||
/* we've already allocated space for these new NULLs */
|
||||
PORT_Assert(dest->len + 2 <= bufferSize);
|
||||
dest->len += 2;
|
||||
dest->data[dest->len - 1] = dest->data[dest->len - 2] = 0;
|
||||
}
|
||||
|
||||
if (!dest->data) {
|
||||
return PR_FALSE;
|
||||
/* ascii/utf-8 adds just 1 */
|
||||
} else if (!dest->len || dest->data[dest->len - 1]) {
|
||||
PORT_Assert(dest->len + 1 <= bufferSize);
|
||||
dest->len++;
|
||||
dest->data[dest->len - 1] = 0;
|
||||
}
|
||||
} else {
|
||||
/* handle the drop case, no need to do any allocations here. */
|
||||
if (toUnicode) {
|
||||
while ((dest->len >= 2) && !dest->data[dest->len - 1] &&
|
||||
!dest->data[dest->len - 2]) {
|
||||
dest->len -= 2;
|
||||
}
|
||||
} else {
|
||||
while (dest->len && !dest->data[dest->len - 1]) {
|
||||
dest->len--;
|
||||
}
|
||||
}
|
||||
dest->len += 2;
|
||||
dest->data[dest->len - 1] = dest->data[dest->len - 2] = 0;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
|
@ -980,7 +1029,8 @@ sec_pkcs12_is_pkcs12_pbe_algorithm(SECOidTag algorithm)
|
|||
*
|
||||
* we assume that the pwitem is already encoded in Unicode by the
|
||||
* caller. if the encryption scheme is not the one defined in PKCS
|
||||
* #12, decode the pwitem back into UTF-8. */
|
||||
* #12, decode the pwitem back into UTF-8. NOTE: UTF-8 strings are
|
||||
* used in the PRF without the trailing NULL */
|
||||
PRBool
|
||||
sec_pkcs12_decode_password(PLArenaPool *arena,
|
||||
SECItem *result,
|
||||
|
|
@ -990,7 +1040,7 @@ sec_pkcs12_decode_password(PLArenaPool *arena,
|
|||
if (!sec_pkcs12_is_pkcs12_pbe_algorithm(algorithm))
|
||||
return sec_pkcs12_convert_item_to_unicode(arena, result,
|
||||
(SECItem *)pwitem,
|
||||
PR_TRUE, PR_FALSE, PR_FALSE);
|
||||
PR_FALSE, PR_FALSE, PR_FALSE);
|
||||
|
||||
return SECITEM_CopyItem(arena, result, pwitem) == SECSuccess;
|
||||
}
|
||||
|
|
@ -1019,117 +1069,106 @@ sec_pkcs12_encode_password(PLArenaPool *arena,
|
|||
static const SEC_ASN1TemplateChooserPtr sec_pkcs12_shroud_chooser =
|
||||
sec_pkcs12_choose_shroud_type;
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CodedSafeBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12SafeBag, derSafeContent) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CodedSafeBagTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12SafeBag, derSafeContent) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CodedCertBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12CertAndCRL, derValue) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CodedCertBagTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12CertAndCRL, derValue) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CodedCertAndCRLBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CodedCertBagTemplate },
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CodedCertAndCRLBagTemplate[] = {
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CodedCertBagTemplate },
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12ESPVKItemTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12ESPVKItem) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12ESPVKItem, espvkOID) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12ESPVKItem, espvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate_OLD },
|
||||
{ SEC_ASN1_EXPLICIT | SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC |
|
||||
SEC_ASN1_DYNAMIC | 0,
|
||||
offsetof(SEC_PKCS12ESPVKItem, espvkCipherText),
|
||||
&sec_pkcs12_shroud_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12ESPVKItemTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12ESPVKItem) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12ESPVKItem, espvkOID) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12ESPVKItem, espvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate_OLD },
|
||||
{ SEC_ASN1_EXPLICIT | SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC |
|
||||
SEC_ASN1_DYNAMIC | 0,
|
||||
offsetof(SEC_PKCS12ESPVKItem, espvkCipherText),
|
||||
&sec_pkcs12_shroud_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12ESPVKItemTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12ESPVKItem) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12ESPVKItem, espvkOID) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12ESPVKItem, espvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate },
|
||||
{ SEC_ASN1_EXPLICIT | SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC |
|
||||
SEC_ASN1_DYNAMIC | 0,
|
||||
offsetof(SEC_PKCS12ESPVKItem, espvkCipherText),
|
||||
&sec_pkcs12_shroud_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12ESPVKItemTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12ESPVKItem) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12ESPVKItem, espvkOID) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12ESPVKItem, espvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate },
|
||||
{ SEC_ASN1_EXPLICIT | SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC |
|
||||
SEC_ASN1_DYNAMIC | 0,
|
||||
offsetof(SEC_PKCS12ESPVKItem, espvkCipherText),
|
||||
&sec_pkcs12_shroud_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PVKAdditionalDataTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKAdditionalData) },
|
||||
{ SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12PVKAdditionalData, pvkAdditionalType) },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12PVKAdditionalData, pvkAdditionalContent) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PVKAdditionalDataTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKAdditionalData) },
|
||||
{ SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12PVKAdditionalData, pvkAdditionalType) },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12PVKAdditionalData, pvkAdditionalContent) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PVKSupportingDataTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKSupportingData) },
|
||||
{ SEC_ASN1_SET_OF | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, assocCerts),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, regenerable) },
|
||||
{ SEC_ASN1_PRINTABLE_STRING,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, nickname) },
|
||||
{ SEC_ASN1_ANY | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, pvkAdditionalDER) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PVKSupportingDataTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKSupportingData) },
|
||||
{ SEC_ASN1_SET_OF | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, assocCerts),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, regenerable) },
|
||||
{ SEC_ASN1_PRINTABLE_STRING,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, nickname) },
|
||||
{ SEC_ASN1_ANY | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, pvkAdditionalDER) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PVKSupportingDataTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKSupportingData) },
|
||||
{ SEC_ASN1_SET_OF | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, assocCerts),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, regenerable) },
|
||||
{ SEC_ASN1_BMP_STRING,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, uniNickName) },
|
||||
{ SEC_ASN1_ANY | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, pvkAdditionalDER) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PVKSupportingDataTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PVKSupportingData) },
|
||||
{ SEC_ASN1_SET_OF | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, assocCerts),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, regenerable) },
|
||||
{ SEC_ASN1_BMP_STRING,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, uniNickName) },
|
||||
{ SEC_ASN1_ANY | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12PVKSupportingData, pvkAdditionalDER) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageItemTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12BaggageItem) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, espvks),
|
||||
SEC_PKCS12ESPVKItemTemplate },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, unencSecrets),
|
||||
SEC_PKCS12SafeBagTemplate },
|
||||
/*{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, unencSecrets),
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageItemTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12BaggageItem) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, espvks),
|
||||
SEC_PKCS12ESPVKItemTemplate },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, unencSecrets),
|
||||
SEC_PKCS12SafeBagTemplate },
|
||||
/*{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12BaggageItem, unencSecrets),
|
||||
SEC_PKCS12CodedSafeBagTemplate }, */
|
||||
{ 0 }
|
||||
};
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12Baggage, bags),
|
||||
SEC_PKCS12BaggageItemTemplate },
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageTemplate[] = {
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12Baggage, bags),
|
||||
SEC_PKCS12BaggageItemTemplate },
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12Baggage_OLD, espvks),
|
||||
SEC_PKCS12ESPVKItemTemplate_OLD },
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12BaggageTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12Baggage_OLD, espvks),
|
||||
SEC_PKCS12ESPVKItemTemplate_OLD },
|
||||
};
|
||||
|
||||
static const SEC_ASN1TemplateChooserPtr sec_pkcs12_bag_chooser =
|
||||
sec_pkcs12_choose_bag_type;
|
||||
|
|
@ -1137,87 +1176,78 @@ static const SEC_ASN1TemplateChooserPtr sec_pkcs12_bag_chooser =
|
|||
static const SEC_ASN1TemplateChooserPtr sec_pkcs12_bag_chooser_old =
|
||||
sec_pkcs12_choose_bag_type_old;
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SafeBagTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12SafeBag, safeContent),
|
||||
&sec_pkcs12_bag_chooser_old },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SafeBagTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12SafeBag, safeContent),
|
||||
&sec_pkcs12_bag_chooser_old },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SafeBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_POINTER,
|
||||
offsetof(SEC_PKCS12SafeBag, safeContent),
|
||||
&sec_pkcs12_bag_chooser },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BMP_STRING,
|
||||
offsetof(SEC_PKCS12SafeBag, uniSafeBagName) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SafeBagTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SafeBag) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12SafeBag, safeBagType) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_POINTER,
|
||||
offsetof(SEC_PKCS12SafeBag, safeContent),
|
||||
&sec_pkcs12_bag_chooser },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BMP_STRING,
|
||||
offsetof(SEC_PKCS12SafeBag, uniSafeBagName) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SafeContentsTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12SafeContents, contents),
|
||||
SEC_PKCS12SafeBagTemplate_OLD }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SafeContentsTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12SafeContents, contents),
|
||||
SEC_PKCS12SafeBagTemplate_OLD }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SafeContentsTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12SafeContents, contents),
|
||||
SEC_PKCS12SafeBagTemplate } /* here */
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SafeContentsTemplate[] = {
|
||||
{ SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12SafeContents, contents),
|
||||
SEC_PKCS12SafeBagTemplate } /* here */
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PrivateKeyTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PrivateKey) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12PrivateKey, pvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PrivateKey, pkcs8data),
|
||||
SEC_ASN1_SUB(SECKEY_PrivateKeyInfoTemplate) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PrivateKeyTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PrivateKey) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12PrivateKey, pvkData),
|
||||
SEC_PKCS12PVKSupportingDataTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12PrivateKey, pkcs8data),
|
||||
SEC_ASN1_SUB(SECKEY_PrivateKeyInfoTemplate) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PrivateKeyBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PrivateKeyBag) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12PrivateKeyBag, privateKeys),
|
||||
SEC_PKCS12PrivateKeyTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PrivateKeyBagTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PrivateKeyBag) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12PrivateKeyBag, privateKeys),
|
||||
SEC_PKCS12PrivateKeyTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12X509CertCRLTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12X509CertCRL, certOrCRL),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12X509CertCRL, thumbprint),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12X509CertCRLTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12X509CertCRL, certOrCRL),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN,
|
||||
offsetof(SEC_PKCS12X509CertCRL, thumbprint),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12X509CertCRLTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12X509CertCRL, certOrCRL),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12X509CertCRLTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_INLINE, offsetof(SEC_PKCS12X509CertCRL, certOrCRL),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SDSICertTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_IA5_STRING, offsetof(SEC_PKCS12SDSICert, value) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SDSICertTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12X509CertCRL) },
|
||||
{ SEC_ASN1_IA5_STRING, offsetof(SEC_PKCS12SDSICert, value) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const SEC_ASN1TemplateChooserPtr sec_pkcs12_cert_crl_chooser_old =
|
||||
sec_pkcs12_choose_cert_crl_type_old;
|
||||
|
|
@ -1225,183 +1255,163 @@ static const SEC_ASN1TemplateChooserPtr sec_pkcs12_cert_crl_chooser_old =
|
|||
static const SEC_ASN1TemplateChooserPtr sec_pkcs12_cert_crl_chooser =
|
||||
sec_pkcs12_choose_cert_crl_type;
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | 0,
|
||||
offsetof(SEC_PKCS12CertAndCRL, value),
|
||||
&sec_pkcs12_cert_crl_chooser_old },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | 0,
|
||||
offsetof(SEC_PKCS12CertAndCRL, value),
|
||||
&sec_pkcs12_cert_crl_chooser_old },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12CertAndCRL, value),
|
||||
&sec_pkcs12_cert_crl_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRL) },
|
||||
{ SEC_ASN1_OBJECT_ID, offsetof(SEC_PKCS12CertAndCRL, BagID) },
|
||||
{ SEC_ASN1_DYNAMIC | SEC_ASN1_CONSTRUCTED | SEC_ASN1_EXPLICIT |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12CertAndCRL, value),
|
||||
&sec_pkcs12_cert_crl_chooser },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CertAndCRLTemplate },
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLBagTemplate[] = {
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CertAndCRLTemplate },
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLBagTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRLBag) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CertAndCRLTemplate_OLD },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12CertAndCRLBagTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12CertAndCRLBag) },
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12CertAndCRLBag, certAndCRLs),
|
||||
SEC_PKCS12CertAndCRLTemplate_OLD },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SecretAdditionalTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SecretAdditional) },
|
||||
{ SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12SecretAdditional, secretAdditionalType) },
|
||||
{ SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_EXPLICIT,
|
||||
offsetof(SEC_PKCS12SecretAdditional, secretAdditionalContent) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SecretAdditionalTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12SecretAdditional) },
|
||||
{ SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12SecretAdditional, secretAdditionalType) },
|
||||
{ SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_EXPLICIT,
|
||||
offsetof(SEC_PKCS12SecretAdditional, secretAdditionalContent) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SecretTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12Secret) },
|
||||
{ SEC_ASN1_BMP_STRING, offsetof(SEC_PKCS12Secret, uniSecretName) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12Secret, value) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12Secret, secretAdditional),
|
||||
SEC_PKCS12SecretAdditionalTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SecretTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12Secret) },
|
||||
{ SEC_ASN1_BMP_STRING, offsetof(SEC_PKCS12Secret, uniSecretName) },
|
||||
{ SEC_ASN1_ANY, offsetof(SEC_PKCS12Secret, value) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12Secret, secretAdditional),
|
||||
SEC_PKCS12SecretAdditionalTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SecretItemTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12Secret) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12SecretItem, secret), SEC_PKCS12SecretTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12SecretItem, subFolder), SEC_PKCS12SafeBagTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SecretItemTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12Secret) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12SecretItem, secret), SEC_PKCS12SecretTemplate },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12SecretItem, subFolder), SEC_PKCS12SafeBagTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12SecretBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12SecretBag, secrets),
|
||||
SEC_PKCS12SecretItemTemplate },
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12SecretBagTemplate[] = {
|
||||
{ SEC_ASN1_SET_OF, offsetof(SEC_PKCS12SecretBag, secrets),
|
||||
SEC_PKCS12SecretItemTemplate },
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12MacDataTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(SEC_PKCS12MacData, safeMac),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_BIT_STRING, offsetof(SEC_PKCS12MacData, macSalt) },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12MacDataTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(SEC_PKCS12MacData, safeMac),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_BIT_STRING, offsetof(SEC_PKCS12MacData, macSalt) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PFXItemTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_OPTIONAL |
|
||||
SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12PFXItem, macData), SEC_PKCS12MacDataTemplate },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12PFXItem, authSafe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PFXItemTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_OPTIONAL |
|
||||
SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12PFXItem, macData), SEC_PKCS12MacDataTemplate },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12PFXItem, authSafe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12PFXItemTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_OPTIONAL |
|
||||
SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 0,
|
||||
offsetof(SEC_PKCS12PFXItem, old_safeMac),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BIT_STRING,
|
||||
offsetof(SEC_PKCS12PFXItem, old_macSalt) },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12PFXItem, authSafe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12PFXItemTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12PFXItem) },
|
||||
{ SEC_ASN1_OPTIONAL |
|
||||
SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_XTRN | 0,
|
||||
offsetof(SEC_PKCS12PFXItem, old_safeMac),
|
||||
SEC_ASN1_SUB(sgn_DigestInfoTemplate) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_BIT_STRING,
|
||||
offsetof(SEC_PKCS12PFXItem, old_macSalt) },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12PFXItem, authSafe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12AuthenticatedSafeTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12AuthenticatedSafe) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, version) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, transportMode) },
|
||||
{ SEC_ASN1_BIT_STRING | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, privacySalt) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, baggage.bags),
|
||||
SEC_PKCS12BaggageItemTemplate },
|
||||
{ SEC_ASN1_POINTER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, safe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12AuthenticatedSafeTemplate[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12AuthenticatedSafe) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, version) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_OBJECT_ID,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, transportMode) },
|
||||
{ SEC_ASN1_BIT_STRING | SEC_ASN1_OPTIONAL,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, privacySalt) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_SET_OF,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, baggage.bags),
|
||||
SEC_PKCS12BaggageItemTemplate },
|
||||
{ SEC_ASN1_POINTER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, safe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PKCS12AuthenticatedSafeTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12AuthenticatedSafe) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, version) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, transportMode) },
|
||||
{ SEC_ASN1_BIT_STRING,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, privacySalt) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_CONSTRUCTED |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, old_baggage),
|
||||
SEC_PKCS12BaggageTemplate_OLD },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, old_safe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PKCS12AuthenticatedSafeTemplate_OLD[] = {
|
||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SEC_PKCS12AuthenticatedSafe) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, version) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, transportMode) },
|
||||
{ SEC_ASN1_BIT_STRING,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, privacySalt) },
|
||||
{ SEC_ASN1_OPTIONAL | SEC_ASN1_CONSTRUCTED |
|
||||
SEC_ASN1_CONTEXT_SPECIFIC | 0,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, old_baggage),
|
||||
SEC_PKCS12BaggageTemplate_OLD },
|
||||
{ SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 1,
|
||||
offsetof(SEC_PKCS12AuthenticatedSafe, old_safe),
|
||||
sec_PKCS7ContentInfoTemplate },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12KeyBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12PrivateKeyBagTemplate }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12KeyBagTemplate[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12PrivateKeyBagTemplate }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12CertAndCRLBagTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12CertAndCRLBagTemplate_OLD }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12CertAndCRLBagTemplate_OLD[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12CertAndCRLBagTemplate_OLD }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12CertAndCRLBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12CertAndCRLBagTemplate }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12CertAndCRLBagTemplate[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12CertAndCRLBagTemplate }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12SecretBagTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12SecretBagTemplate }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12SecretBagTemplate[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12SecretBagTemplate }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12X509CertCRLTemplate_OLD[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12X509CertCRLTemplate_OLD }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12X509CertCRLTemplate_OLD[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12X509CertCRLTemplate_OLD }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12X509CertCRLTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12X509CertCRLTemplate }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12X509CertCRLTemplate[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12X509CertCRLTemplate }
|
||||
};
|
||||
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12SDSICertTemplate[] =
|
||||
{
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12SDSICertTemplate }
|
||||
};
|
||||
const SEC_ASN1Template SEC_PointerToPKCS12SDSICertTemplate[] = {
|
||||
{ SEC_ASN1_POINTER, 0, SEC_PKCS12SDSICertTemplate }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ extern PRBool sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *de
|
|||
SECItem *src, PRBool zeroTerm,
|
||||
PRBool asciiConvert, PRBool toUnicode);
|
||||
extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_mech(SECOidTag algtag);
|
||||
extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_keygen_mech(SECOidTag algtag);
|
||||
|
||||
/* create functions */
|
||||
extern SEC_PKCS12PFXItem *sec_pkcs12_new_pfx(void);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "secoid.h"
|
||||
#include "secport.h"
|
||||
#include "secpkcs5.h"
|
||||
#include "secerr.h"
|
||||
|
||||
#define PKCS12_NULL 0x0000
|
||||
|
||||
|
|
@ -32,31 +33,32 @@ static pkcs12SuiteMap pkcs12SuiteMaps[] = {
|
|||
};
|
||||
|
||||
/* determine if algid is an algorithm which is allowed */
|
||||
static PRBool
|
||||
sec_PKCS12Allowed(SECOidTag alg)
|
||||
{
|
||||
PRUint32 policy;
|
||||
SECStatus rv;
|
||||
|
||||
rv = NSS_GetAlgorithmPolicy(alg, &policy);
|
||||
if (rv != SECSuccess) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (policy & NSS_USE_ALG_IN_PKCS12) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
SEC_PKCS12DecryptionAllowed(SECAlgorithmID *algid)
|
||||
{
|
||||
unsigned int keyLengthBits;
|
||||
SECOidTag algId;
|
||||
int i;
|
||||
|
||||
algId = SEC_PKCS5GetCryptoAlgorithm(algid);
|
||||
if (algId == SEC_OID_UNKNOWN) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
keyLengthBits = (unsigned int)(SEC_PKCS5GetKeyLength(algid) * 8);
|
||||
|
||||
i = 0;
|
||||
while (pkcs12SuiteMaps[i].algTag != SEC_OID_UNKNOWN) {
|
||||
if ((pkcs12SuiteMaps[i].algTag == algId) &&
|
||||
(pkcs12SuiteMaps[i].keyLengthBits == keyLengthBits)) {
|
||||
|
||||
return pkcs12SuiteMaps[i].allowed;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
return sec_PKCS12Allowed(algId);
|
||||
}
|
||||
|
||||
/* is any encryption allowed? */
|
||||
|
|
@ -65,61 +67,40 @@ SEC_PKCS12IsEncryptionAllowed(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (pkcs12SuiteMaps[i].algTag != SEC_OID_UNKNOWN) {
|
||||
if (pkcs12SuiteMaps[i].allowed == PR_TRUE) {
|
||||
for (i = 0; pkcs12SuiteMaps[i].algTag != SEC_OID_UNKNOWN; i++) {
|
||||
/* we're going to return true here if any of the traditional
|
||||
* algorithms are enabled */
|
||||
if (sec_PKCS12Allowed(pkcs12SuiteMaps[i].algTag)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* keep the traditional enable/disable for old ciphers so old applications
|
||||
* continue to work. This only works for the traditional pkcs12 values,
|
||||
* you need to use NSS_SetAlgorithmPolicy directly for other ciphers. */
|
||||
SECStatus
|
||||
SEC_PKCS12EnableCipher(long which, int on)
|
||||
{
|
||||
int i;
|
||||
PRUint32 set = on ? NSS_USE_ALG_IN_PKCS12 : 0;
|
||||
PRUint32 clear = on ? 0 : NSS_USE_ALG_IN_PKCS12;
|
||||
|
||||
i = 0;
|
||||
while (pkcs12SuiteMaps[i].suite != 0L) {
|
||||
for (i = 0; pkcs12SuiteMaps[i].suite != 0L; i++) {
|
||||
if (pkcs12SuiteMaps[i].suite == (unsigned long)which) {
|
||||
if (on) {
|
||||
pkcs12SuiteMaps[i].allowed = PR_TRUE;
|
||||
} else {
|
||||
pkcs12SuiteMaps[i].allowed = PR_FALSE;
|
||||
}
|
||||
return SECSuccess;
|
||||
return NSS_SetAlgorithmPolicy(pkcs12SuiteMaps[i].algTag, set, clear);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
SECStatus
|
||||
SEC_PKCS12SetPreferredCipher(long which, int on)
|
||||
{
|
||||
int i;
|
||||
PRBool turnedOff = PR_FALSE;
|
||||
PRBool turnedOn = PR_FALSE;
|
||||
|
||||
i = 0;
|
||||
while (pkcs12SuiteMaps[i].suite != 0L) {
|
||||
if (pkcs12SuiteMaps[i].preferred == PR_TRUE) {
|
||||
pkcs12SuiteMaps[i].preferred = PR_FALSE;
|
||||
turnedOff = PR_TRUE;
|
||||
}
|
||||
if (pkcs12SuiteMaps[i].suite == (unsigned long)which) {
|
||||
pkcs12SuiteMaps[i].preferred = PR_TRUE;
|
||||
turnedOn = PR_TRUE;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if ((turnedOn) && (turnedOff)) {
|
||||
return SECSuccess;
|
||||
}
|
||||
|
||||
return SECFailure;
|
||||
/* nothing looked at the preferences in the suite maps, so this function
|
||||
* has always been a noop */
|
||||
return SECSuccess;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue