⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkcs7_asn.c

📁 vc环境下的pgp源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************
 *
 * This file was generated by TIS/ASN1COMP Ver. 4.0, an ASN.1 compiler.
 * TIS/ASN1COMP is Copyright (c) 1998, TIS Labs at Network Associates, Inc.
 *
 * This file was AUTOMATICALLY GENERATED on Wed Nov 18 16:32:31 1998
 *
 ******************************************************************/


#include <string.h>

#include "pkcs7_asn.h"

/*******************************************************************
 *
 * Code for manipulating ASN.1 DER data and structure.
 *
 *  NewXXX: Allocate the top level of a structure.
 *
 *  FreeXXX: Release all the data of an ASN structure.
 *
 *  SizeofXXX: Return the size of the DER block that would
 *               be created from the structure.
 *
 *  PackXXX: Take an ASN structure and return the DER.
 *
 *  unPackXXX: Take the DER and return an ASN structure.
 *
 ******************************************************************/


/******************************************************************
 * Routines for CertificateRevocationLists
 ******************************************************************/

PKICertificateRevocationLists *PKINewCertificateRevocationLists(
    PKICONTEXT *ctx)
{
    PKICertificateRevocationLists *f;

    if (ctx == NULL)
        return NULL;

    f = (PKICertificateRevocationLists *)PKIAlloc(ctx->memMgr, sizeof(PKICertificateRevocationLists));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKICertificateRevocationLists));
    return (f);

} /* PKINewCertificateRevocationLists */

void PKIFreeCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceCertificateRevocationLists(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeCertificateRevocationLists */

size_t PKISizeofCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofCertificateRevocationListsInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofCertificateRevocationLists */

size_t PKIPackCertificateRevocationLists(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKICertificateRevocationLists *asnstruct,
    int *erret )
{
    return(PKIPackCertificateRevocationListsInternal(ctx, buf, buflen, asnstruct, PKIID_CertificateRevocationLists, erret));
} /* PKIPackCertificateRevocationLists */

size_t PKIUnpackCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackCertificateRevocationListsInternal(ctx, asnstruct, buf, buflen,
                      PKIID_CertificateRevocationLists, erret));
}

/******************************************************************
 * Routines for ContentInfo
 ******************************************************************/

PKIContentInfo *PKINewContentInfo(
    PKICONTEXT *ctx)
{
    PKIContentInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIContentInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIContentInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIContentInfo));
    return (f);

} /* PKINewContentInfo */

void PKIFreeContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceContentInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeContentInfo */

size_t PKISizeofContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofContentInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofContentInfo */

size_t PKIPackContentInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIContentInfo *asnstruct,
    int *erret )
{
    return(PKIPackContentInfoInternal(ctx, buf, buflen, asnstruct, PKIID_ContentInfo, erret));
} /* PKIPackContentInfo */

size_t PKIUnpackContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackContentInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ContentInfo, erret));
}

/******************************************************************
 * Routines for ExtendedCertificateInfo
 ******************************************************************/

PKIExtendedCertificateInfo *PKINewExtendedCertificateInfo(
    PKICONTEXT *ctx)
{
    PKIExtendedCertificateInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIExtendedCertificateInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIExtendedCertificateInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIExtendedCertificateInfo));
    return (f);

} /* PKINewExtendedCertificateInfo */

void PKIFreeExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceExtendedCertificateInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeExtendedCertificateInfo */

size_t PKISizeofExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofExtendedCertificateInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofExtendedCertificateInfo */

size_t PKIPackExtendedCertificateInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIExtendedCertificateInfo *asnstruct,
    int *erret )
{
    return(PKIPackExtendedCertificateInfoInternal(ctx, buf, buflen, asnstruct, PKIID_ExtendedCertificateInfo, erret));
} /* PKIPackExtendedCertificateInfo */

size_t PKIUnpackExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackExtendedCertificateInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ExtendedCertificateInfo, erret));
}

/******************************************************************
 * Routines for IssuerAndSerialNumber
 ******************************************************************/

PKIIssuerAndSerialNumber *PKINewIssuerAndSerialNumber(
    PKICONTEXT *ctx)
{
    PKIIssuerAndSerialNumber *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIIssuerAndSerialNumber *)PKIAlloc(ctx->memMgr, sizeof(PKIIssuerAndSerialNumber));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIIssuerAndSerialNumber));
    return (f);

} /* PKINewIssuerAndSerialNumber */

void PKIFreeIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceIssuerAndSerialNumber(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeIssuerAndSerialNumber */

size_t PKISizeofIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofIssuerAndSerialNumberInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofIssuerAndSerialNumber */

size_t PKIPackIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIIssuerAndSerialNumber *asnstruct,
    int *erret )
{
    return(PKIPackIssuerAndSerialNumberInternal(ctx, buf, buflen, asnstruct, PKIID_IssuerAndSerialNumber, erret));
} /* PKIPackIssuerAndSerialNumber */

size_t PKIUnpackIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackIssuerAndSerialNumberInternal(ctx, asnstruct, buf, buflen,
                      PKIID_IssuerAndSerialNumber, erret));
}

/******************************************************************
 * Routines for DigestAlgorithmIdentifiers
 ******************************************************************/

PKIDigestAlgorithmIdentifiers *PKINewDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx)
{
    PKIDigestAlgorithmIdentifiers *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIDigestAlgorithmIdentifiers *)PKIAlloc(ctx->memMgr, sizeof(PKIDigestAlgorithmIdentifiers));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIDigestAlgorithmIdentifiers));
    return (f);

} /* PKINewDigestAlgorithmIdentifiers */

void PKIFreeDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceDigestAlgorithmIdentifiers(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeDigestAlgorithmIdentifiers */

size_t PKISizeofDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofDigestAlgorithmIdentifiersInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofDigestAlgorithmIdentifiers */

size_t PKIPackDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIDigestAlgorithmIdentifiers *asnstruct,
    int *erret )
{
    return(PKIPackDigestAlgorithmIdentifiersInternal(ctx, buf, buflen, asnstruct, PKIID_DigestAlgorithmIdentifiers, erret));
} /* PKIPackDigestAlgorithmIdentifiers */

size_t PKIUnpackDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackDigestAlgorithmIdentifiersInternal(ctx, asnstruct, buf, buflen,
                      PKIID_DigestAlgorithmIdentifiers, erret));
}

/******************************************************************
 * Routines for DigestInfo
 ******************************************************************/

PKIDigestInfo *PKINewDigestInfo(
    PKICONTEXT *ctx)
{
    PKIDigestInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIDigestInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIDigestInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIDigestInfo));
    return (f);

} /* PKINewDigestInfo */

void PKIFreeDigestInfo(
    PKICONTEXT *ctx,
    PKIDigestInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceDigestInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeDigestInfo */

size_t PKISizeofDigestInfo(
    PKICONTEXT *ctx,
    PKIDigestInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofDigestInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofDigestInfo */

size_t PKIPackDigestInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIDigestInfo *asnstruct,
    int *erret )
{
    return(PKIPackDigestInfoInternal(ctx, buf, buflen, asnstruct, PKIID_DigestInfo, erret));
} /* PKIPackDigestInfo */

size_t PKIUnpackDigestInfo(
    PKICONTEXT *ctx,
    PKIDigestInfo **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackDigestInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_DigestInfo, erret));
}

/******************************************************************
 * Routines for EncryptedContentInfo
 ******************************************************************/

PKIEncryptedContentInfo *PKINewEncryptedContentInfo(
    PKICONTEXT *ctx)
{
    PKIEncryptedContentInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIEncryptedContentInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIEncryptedContentInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIEncryptedContentInfo));
    return (f);

} /* PKINewEncryptedContentInfo */

void PKIFreeEncryptedContentInfo(
    PKICONTEXT *ctx,
    PKIEncryptedContentInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceEncryptedContentInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeEncryptedContentInfo */

size_t PKISizeofEncryptedContentInfo(
    PKICONTEXT *ctx,
    PKIEncryptedContentInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofEncryptedContentInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofEncryptedContentInfo */

size_t PKIPackEncryptedContentInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIEncryptedContentInfo *asnstruct,
    int *erret )
{
    return(PKIPackEncryptedContentInfoInternal(ctx, buf, buflen, asnstruct, PKIID_EncryptedContentInfo, erret));
} /* PKIPackEncryptedContentInfo */

size_t PKIUnpackEncryptedContentInfo(
    PKICONTEXT *ctx,
    PKIEncryptedContentInfo **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackEncryptedContentInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_EncryptedContentInfo, erret));
}

/******************************************************************
 * Routines for ExtendedCertificate
 ******************************************************************/

PKIExtendedCertificate *PKINewExtendedCertificate(
    PKICONTEXT *ctx)
{
    PKIExtendedCertificate *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIExtendedCertificate *)PKIAlloc(ctx->memMgr, sizeof(PKIExtendedCertificate));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIExtendedCertificate));
    return (f);

} /* PKINewExtendedCertificate */

void PKIFreeExtendedCertificate(
    PKICONTEXT *ctx,
    PKIExtendedCertificate *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceExtendedCertificate(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeExtendedCertificate */

size_t PKISizeofExtendedCertificate(
    PKICONTEXT *ctx,
    PKIExtendedCertificate *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofExtendedCertificateInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofExtendedCertificate */

size_t PKIPackExtendedCertificate(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIExtendedCertificate *asnstruct,
    int *erret )
{
    return(PKIPackExtendedCertificateInternal(ctx, buf, buflen, asnstruct, PKIID_ExtendedCertificate, erret));
} /* PKIPackExtendedCertificate */

size_t PKIUnpackExtendedCertificate(
    PKICONTEXT *ctx,
    PKIExtendedCertificate **asnstruct,
    unsigned char *buf,
    size_t buflen,
    int *erret)
{
    return(PKIUnpackExtendedCertificateInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ExtendedCertificate, erret));
}

/******************************************************************
 * Routines for RecipientInfo
 ******************************************************************/

PKIRecipientInfo *PKINewRecipientInfo(
    PKICONTEXT *ctx)
{
    PKIRecipientInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIRecipientInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIRecipientInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIRecipientInfo));
    return (f);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -