📄 pgpx509cert_asn.c
字号:
f = (PGPASN_RSAKey *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_RSAKey));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_RSAKey));
return (f);
} /* pgpasn_NewRSAKey */
void pgpasn_FreeRSAKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAKey *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceRSAKey(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeRSAKey */
size_t pgpasn_SizeofRSAKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAKey *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofRSAKeyInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofRSAKey */
size_t pgpasn_PackRSAKey(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_RSAKey *asnstruct,
int *erret )
{
return(pgpasn_PackRSAKeyInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_RSAKey, erret));
} /* pgpasn_PackRSAKey */
size_t pgpasn_UnpackRSAKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAKey **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackRSAKeyInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_RSAKey, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for RSAPrivateKey
******************************************************************/
PGPASN_RSAPrivateKey *pgpasn_NewRSAPrivateKey(
PGPASN_CONTEXT *ctx)
{
PGPASN_RSAPrivateKey *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_RSAPrivateKey *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_RSAPrivateKey));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_RSAPrivateKey));
return (f);
} /* pgpasn_NewRSAPrivateKey */
void pgpasn_FreeRSAPrivateKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAPrivateKey *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceRSAPrivateKey(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeRSAPrivateKey */
size_t pgpasn_SizeofRSAPrivateKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAPrivateKey *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofRSAPrivateKeyInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofRSAPrivateKey */
size_t pgpasn_PackRSAPrivateKey(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_RSAPrivateKey *asnstruct,
int *erret )
{
return(pgpasn_PackRSAPrivateKeyInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_RSAPrivateKey, erret));
} /* pgpasn_PackRSAPrivateKey */
size_t pgpasn_UnpackRSAPrivateKey(
PGPASN_CONTEXT *ctx,
PGPASN_RSAPrivateKey **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackRSAPrivateKeyInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_RSAPrivateKey, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for XIssuerAndSerialNumber
******************************************************************/
PGPASN_XIssuerAndSerialNumber *pgpasn_NewXIssuerAndSerialNumber(
PGPASN_CONTEXT *ctx)
{
PGPASN_XIssuerAndSerialNumber *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_XIssuerAndSerialNumber *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_XIssuerAndSerialNumber));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_XIssuerAndSerialNumber));
return (f);
} /* pgpasn_NewXIssuerAndSerialNumber */
void pgpasn_FreeXIssuerAndSerialNumber(
PGPASN_CONTEXT *ctx,
PGPASN_XIssuerAndSerialNumber *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceXIssuerAndSerialNumber(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeXIssuerAndSerialNumber */
size_t pgpasn_SizeofXIssuerAndSerialNumber(
PGPASN_CONTEXT *ctx,
PGPASN_XIssuerAndSerialNumber *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofXIssuerAndSerialNumberInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofXIssuerAndSerialNumber */
size_t pgpasn_PackXIssuerAndSerialNumber(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_XIssuerAndSerialNumber *asnstruct,
int *erret )
{
return(pgpasn_PackXIssuerAndSerialNumberInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_XIssuerAndSerialNumber, erret));
} /* pgpasn_PackXIssuerAndSerialNumber */
size_t pgpasn_UnpackXIssuerAndSerialNumber(
PGPASN_CONTEXT *ctx,
PGPASN_XIssuerAndSerialNumber **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackXIssuerAndSerialNumberInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_XIssuerAndSerialNumber, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for XXCertificate
******************************************************************/
PGPASN_XXCertificate *pgpasn_NewXXCertificate(
PGPASN_CONTEXT *ctx)
{
PGPASN_XXCertificate *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_XXCertificate *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_XXCertificate));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_XXCertificate));
return (f);
} /* pgpasn_NewXXCertificate */
void pgpasn_FreeXXCertificate(
PGPASN_CONTEXT *ctx,
PGPASN_XXCertificate *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceXXCertificate(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeXXCertificate */
size_t pgpasn_SizeofXXCertificate(
PGPASN_CONTEXT *ctx,
PGPASN_XXCertificate *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofXXCertificateInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofXXCertificate */
size_t pgpasn_PackXXCertificate(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_XXCertificate *asnstruct,
int *erret )
{
return(pgpasn_PackXXCertificateInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_XXCertificate, erret));
} /* pgpasn_PackXXCertificate */
size_t pgpasn_UnpackXXCertificate(
PGPASN_CONTEXT *ctx,
PGPASN_XXCertificate **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackXXCertificateInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_XXCertificate, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for Attribute
******************************************************************/
PGPASN_Attribute *pgpasn_NewAttribute(
PGPASN_CONTEXT *ctx)
{
PGPASN_Attribute *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_Attribute *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_Attribute));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_Attribute));
return (f);
} /* pgpasn_NewAttribute */
void pgpasn_FreeAttribute(
PGPASN_CONTEXT *ctx,
PGPASN_Attribute *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceAttribute(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeAttribute */
size_t pgpasn_SizeofAttribute(
PGPASN_CONTEXT *ctx,
PGPASN_Attribute *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofAttributeInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofAttribute */
size_t pgpasn_PackAttribute(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_Attribute *asnstruct,
int *erret )
{
return(pgpasn_PackAttributeInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_Attribute, erret));
} /* pgpasn_PackAttribute */
size_t pgpasn_UnpackAttribute(
PGPASN_CONTEXT *ctx,
PGPASN_Attribute **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackAttributeInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_Attribute, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for Extensions
******************************************************************/
PGPASN_Extensions *pgpasn_NewExtensions(
PGPASN_CONTEXT *ctx)
{
PGPASN_Extensions *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_Extensions *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_Extensions));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_Extensions));
return (f);
} /* pgpasn_NewExtensions */
void pgpasn_FreeExtensions(
PGPASN_CONTEXT *ctx,
PGPASN_Extensions *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceExtensions(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeExtensions */
size_t pgpasn_SizeofExtensions(
PGPASN_CONTEXT *ctx,
PGPASN_Extensions *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofExtensionsInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofExtensions */
size_t pgpasn_PackExtensions(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_Extensions *asnstruct,
int *erret )
{
return(pgpasn_PackExtensionsInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_Extensions, erret));
} /* pgpasn_PackExtensions */
size_t pgpasn_UnpackExtensions(
PGPASN_CONTEXT *ctx,
PGPASN_Extensions **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackExtensionsInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_Extensions, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for RelativeDistinguishedName
******************************************************************/
PGPASN_RelativeDistinguishedName *pgpasn_NewRelativeDistinguishedName(
PGPASN_CONTEXT *ctx)
{
PGPASN_RelativeDistinguishedName *f;
if (ctx == NULL)
return NULL;
f = (PGPASN_RelativeDistinguishedName *)PGPASN_Alloc(ctx->memMgr, sizeof(PGPASN_RelativeDistinguishedName));
if (f != NULL)
(void)memset(f, 0, sizeof(PGPASN_RelativeDistinguishedName));
return (f);
} /* pgpasn_NewRelativeDistinguishedName */
void pgpasn_FreeRelativeDistinguishedName(
PGPASN_CONTEXT *ctx,
PGPASN_RelativeDistinguishedName *f)
{
if (ctx == NULL)
return;
pgpasn_DropInPlaceRelativeDistinguishedName(ctx, f);
if (f != NULL)
PGPASN_Free(ctx->memMgr, f);
} /* pgpasn_FreeRelativeDistinguishedName */
size_t pgpasn_SizeofRelativeDistinguishedName(
PGPASN_CONTEXT *ctx,
PGPASN_RelativeDistinguishedName *asnstruct,
int outerSizeFlag)
{
(void)ctx; /* for future use */
return(pgpasn_SizeofRelativeDistinguishedNameInternal(asnstruct, outerSizeFlag, PGPASN_FALSE));
} /* pgpasn_SizeofRelativeDistinguishedName */
size_t pgpasn_PackRelativeDistinguishedName(
PGPASN_CONTEXT *ctx,
unsigned char *buf,
size_t buflen,
PGPASN_RelativeDistinguishedName *asnstruct,
int *erret )
{
return(pgpasn_PackRelativeDistinguishedNameInternal(ctx, buf, buflen, asnstruct, PGPASN_ID_RelativeDistinguishedName, erret));
} /* pgpasn_PackRelativeDistinguishedName */
size_t pgpasn_UnpackRelativeDistinguishedName(
PGPASN_CONTEXT *ctx,
PGPASN_RelativeDistinguishedName **asnstruct,
const unsigned char *buf,
size_t buflen,
int *erret)
{
size_t bytesused;
bytesused=pgpasn_UnpackRelativeDistinguishedNameInternal(ctx, asnstruct, buf, buflen,
PGPASN_ID_RelativeDistinguishedName, erret);
if(*erret==0 && bytesused==0)
PGPASN_ERR(kPGPASNError_ErrUnpackUnderrun);
return bytesused;
}
/******************************************************************
* Routines for SubjectPublicKeyInfo
******************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -