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

📄 pkcs7_asn.c

📁 可以实现对邮件的加密解密以及签名
💻 C
📖 第 1 页 / 共 3 页
字号:
    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,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackDigestInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_DigestInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * 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,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackEncryptedContentInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_EncryptedContentInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * 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,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackExtendedCertificateInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ExtendedCertificate, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * 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);

} /* PKINewRecipientInfo */

void PKIFreeRecipientInfo(
    PKICONTEXT *ctx,
    PKIRecipientInfo *f)
{
    if (ctx == NULL)
        return;

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

} /* PKIFreeRecipientInfo */

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

    return(PKISizeofRecipientInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofRecipientInfo */

size_t PKIPackRecipientInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIRecipientInfo *asnstruct,
    int *erret )
{
    return(PKIPackRecipientInfoInternal(ctx, buf, buflen, asnstruct, PKIID_RecipientInfo, erret));
} /* PKIPackRecipientInfo */

size_t PKIUnpackRecipientInfo(
    PKICONTEXT *ctx,
    PKIRecipientInfo **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackRecipientInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_RecipientInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for SignerInfo
 ******************************************************************/

PKISignerInfo *PKINewSignerInfo(
    PKICONTEXT *ctx)
{
    PKISignerInfo *f;

    if (ctx == NULL)
        return NULL;

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

} /* PKINewSignerInfo */

void PKIFreeSignerInfo(
    PKICONTEXT *ctx,
    PKISignerInfo *f)
{
    if (ctx == NULL)
        return;

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

} /* PKIFreeSignerInfo */

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

    return(PKISizeofSignerInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofSignerInfo */

size_t PKIPackSignerInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKISignerInfo *asnstruct,
    int *erret )
{
    return(PKIPackSignerInfoInternal(ctx, buf, buflen, asnstruct, PKIID_SignerInfo, erret));
} /* PKIPackSignerInfo */

size_t PKIUnpackSignerInfo(
    PKICONTEXT *ctx,
    PKISignerInfo **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackSignerInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_SignerInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for EncryptedData
 ******************************************************************/

PKIEncryptedData *PKINewEncryptedData(
    PKICONTEXT *ctx)
{
    PKIEncryptedData *f;

    if (ctx == NULL)
        return NULL;

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

} /* PKINewEncryptedData */

void PKIFreeEncryptedData(
    PKICONTEXT *ctx,
    PKIEncryptedData *f)
{
    if (ctx == NULL)
        return;

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

} /* PKIFreeEncryptedData */

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

    return(PKISizeofEncryptedDataInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofEncryptedData */

size_t PKIPackEncryptedData(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIEncryptedData *asnstruct,
    int *erret )
{
    return(PKIPackEncryptedDataInternal(ctx, buf, buflen, asnstruct, PKIID_EncryptedData, erret));
} /* PKIPackEncryptedData */

size_t PKIUnpackEncryptedData(
    PKICONTEXT *ctx,
    PKIEncryptedData **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackEncryptedDataInternal(ctx, asnstruct, buf, buflen,
                      PKIID_EncryptedData, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for ExtendedCertificateOrCertificate
 ******************************************************************/

PKIExtendedCertificateOrCertificate *PKINewExtendedCertificateOrCertificate(
    PKICONTEXT *ctx)
{
    PKIExtendedCertificateOrCertificate *f;

    if (ctx == NULL)
        return NULL;

⌨️ 快捷键说明

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