asn1.h

来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 880 行 · 第 1/2 页

H
880
字号
extern const NSSError NSS_ERROR_NO_MEMORY;extern const NSSError NSS_ERROR_INVALID_ARENA;extern const NSSError NSS_ERROR_INVALID_POINTER;extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;/* * nssASN1Encoder_Update * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER *  NSS_ERROR_INVALID_POINTER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_Update(  nssASN1Encoder *encoder,  const void *data,  PRUint32 length);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;extern const NSSError NSS_ERROR_INVALID_POINTER;/* * nssASN1Encoder_Finish * * Destructor. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_Finish(  nssASN1Encoder *encoder);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;/* * nssASN1Encoder_SetNotify * * This routine registers a callback notify routine with the encoder, * which will be called whenever.. The specified argument will be * passed as-is to the notify routine.  The routine pointer may be * NULL, in which case no notify routine will be called.  This routine * returns a PRStatus value; in the event of an error it will place * an error on the error stack and return PR_FAILURE. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1DECODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_SetNotify(  nssASN1Encoder *encoder,  nssASN1NotifyFunction *callback,  void *argument);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;/* * nssASN1Encoder_GetNotify * * If the optional pCallbackOpt argument to this routine is non-null, * then the pointer to any callback function established for this * decoder with nssASN1Encoder_SetNotify will be stored at the  * location indicated by it.  If the optional pArgumentOpt pointer is * non-null, the filter's closure argument will be stored there. * This routine returns a PRStatus value; in the event of an error it * will place an error on the error stack and return PR_FAILURE. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_GetNotify(  nssASN1Encoder *encoder,  nssASN1NotifyFunction **pCallbackOpt,  void **pArgumentOpt);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;/* * nssASN1Encoder_SetStreaming * *  * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_SetStreaming(  nssASN1Encoder *encoder,  PRBool streaming);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;/* * nssASN1Encoder_GetStreaming * * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER *  NSS_ERROR_INVALID_POINTER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_GetStreaming(  nssASN1Encoder *encoder,  PRBool *pStreaming);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;extern const NSSError NSS_ERROR_INVALID_POINTER;/* * nssASN1Encoder_SetTakeFromBuffer * * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_SetTakeFromBuffer(  nssASN1Encoder *encoder,  PRBool takeFromBuffer);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;/* * nssASN1Encoder_GetTakeFromBuffer * * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER *  NSS_ERROR_INVALID_POINTER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1Encoder_GetTakeFromBuffer(  nssASN1Encoder *encoder,  PRBool *pTakeFromBuffer);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;extern const NSSError NSS_ERROR_INVALID_POINTER;/* * nssASN1Encoder_verify * * This routine is only available in debug builds. * * If the specified pointer is a valid pointer to an nssASN1Encoder * object, this routine will return PR_SUCCESS.  Otherwise, it will  * put an error on the error stack and return PR_FAILURE. * * The error may be one of the following values: *  NSS_ERROR_INVALID_ASN1ENCODER * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */#ifdef DEBUGNSS_EXTERN PRStatusnssASN1Encoder_verify(  nssASN1Encoder *encoder);extern const NSSError NSS_ERROR_INVALID_ASN1ENCODER;#endif /* DEBUG *//* * nssASN1_Encode * *  * The error may be one of the following values: *  NSS_ERROR_NO_MEMORY *  NSS_ERROR_INVALID_ARENA *  NSS_ERROR_INVALID_POINTER *  NSS_ERROR_ENCODING_NOT_SUPPORTED *  ... * * Return value: *  PR_FAILURE upon error *  PR_SUCCESS upon success */NSS_EXTERN PRStatusnssASN1_Encode(  const void *source,  const nssASN1Template template[],  NSSASN1EncodingType encoding,  nssASN1EncoderWriteFunction *sink,  void *argument);extern const NSSError NSS_ERROR_NO_MEMORY;extern const NSSError NSS_ERROR_INVALID_ARENA;extern const NSSError NSS_ERROR_INVALID_POINTER;extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;/* * nssASN1_EncodeItem * * There must be a better name.  If the optional arena argument is * non-null, it'll be used for the space.  If the optional rvOpt is * non-null, it'll be the return value-- if it is null, a new one * will be allocated. * * The error may be one of the following values: *  NSS_ERROR_NO_MEMORY *  NSS_ERROR_INVALID_ARENA *  NSS_ERROR_INVALID_POINTER *  NSS_ERROR_ENCODING_NOT_SUPPORTED * * Return value: *  NULL upon error *  A valid pointer to an NSSDER upon success */NSS_EXTERN NSSDER *nssASN1_EncodeItem(  NSSArena *arenaOpt,  NSSDER *rvOpt,  const void *source,  const nssASN1Template template[],  NSSASN1EncodingType encoding);extern const NSSError NSS_ERROR_NO_MEMORY;extern const NSSError NSS_ERROR_INVALID_ARENA;extern const NSSError NSS_ERROR_INVALID_POINTER;extern const NSSError NSS_ERROR_ENCODING_NOT_SUPPORTED;/* * Other basic types' encoding and decoding helper functions: * *  nssASN1_CreatePRUint32FromBER *  nssASN1_GetDERFromPRUint32 *  nssASN1_CreatePRInt32FromBER *  nssASN1_GetDERFromPRInt32 * ..etc.. *//* * nssASN1_CreatePRUint32FromBER * */NSS_EXTERN PRStatusnssASN1_CreatePRUint32FromBER(  NSSBER *encoded,  PRUint32 *pResult);/* * nssASN1_GetDERFromPRUint32 * */NSS_EXTERN NSSDER *nssASN1_GetDERFromPRUint32(  NSSArena *arenaOpt,  NSSDER *rvOpt,  PRUint32 value);/* * nssASN1_CreatePRInt32FromBER * */NSS_EXTERN PRStatusnssASN1_CreatePRInt32FromBER(  NSSBER *encoded,  PRInt32 *pResult);/* * nssASN1_GetDERFromPRInt32 * */NSS_EXTERN NSSDER *nssASN1_GetDERFromPRInt32(  NSSArena *arenaOpt,  NSSDER *rvOpt,  PRInt32 value);/* * Builtin templates *//* * Generic Templates * One for each of the simple types, plus a special one for ANY, plus: *	- a pointer to each one of those *	- a set of each one of those * * Note that these are alphabetical (case insensitive); please add new * ones in the appropriate place. */extern const nssASN1Template *nssASN1Template_Any;extern const nssASN1Template *nssASN1Template_BitString;extern const nssASN1Template *nssASN1Template_BMPString;extern const nssASN1Template *nssASN1Template_Boolean;extern const nssASN1Template *nssASN1Template_Enumerated;extern const nssASN1Template *nssASN1Template_GeneralizedTime;extern const nssASN1Template *nssASN1Template_IA5String;extern const nssASN1Template *nssASN1Template_Integer;extern const nssASN1Template *nssASN1Template_Null;extern const nssASN1Template *nssASN1Template_ObjectID;extern const nssASN1Template *nssASN1Template_OctetString;extern const nssASN1Template *nssASN1Template_PrintableString;extern const nssASN1Template *nssASN1Template_T61String;extern const nssASN1Template *nssASN1Template_UniversalString;extern const nssASN1Template *nssASN1Template_UTCTime;extern const nssASN1Template *nssASN1Template_UTF8String;extern const nssASN1Template *nssASN1Template_VisibleString;extern const nssASN1Template *nssASN1Template_PointerToAny;extern const nssASN1Template *nssASN1Template_PointerToBitString;extern const nssASN1Template *nssASN1Template_PointerToBMPString;extern const nssASN1Template *nssASN1Template_PointerToBoolean;extern const nssASN1Template *nssASN1Template_PointerToEnumerated;extern const nssASN1Template *nssASN1Template_PointerToGeneralizedTime;extern const nssASN1Template *nssASN1Template_PointerToIA5String;extern const nssASN1Template *nssASN1Template_PointerToInteger;extern const nssASN1Template *nssASN1Template_PointerToNull;extern const nssASN1Template *nssASN1Template_PointerToObjectID;extern const nssASN1Template *nssASN1Template_PointerToOctetString;extern const nssASN1Template *nssASN1Template_PointerToPrintableString;extern const nssASN1Template *nssASN1Template_PointerToT61String;extern const nssASN1Template *nssASN1Template_PointerToUniversalString;extern const nssASN1Template *nssASN1Template_PointerToUTCTime;extern const nssASN1Template *nssASN1Template_PointerToUTF8String;extern const nssASN1Template *nssASN1Template_PointerToVisibleString;extern const nssASN1Template *nssASN1Template_SetOfAny;extern const nssASN1Template *nssASN1Template_SetOfBitString;extern const nssASN1Template *nssASN1Template_SetOfBMPString;extern const nssASN1Template *nssASN1Template_SetOfBoolean;extern const nssASN1Template *nssASN1Template_SetOfEnumerated;extern const nssASN1Template *nssASN1Template_SetOfGeneralizedTime;extern const nssASN1Template *nssASN1Template_SetOfIA5String;extern const nssASN1Template *nssASN1Template_SetOfInteger;extern const nssASN1Template *nssASN1Template_SetOfNull;extern const nssASN1Template *nssASN1Template_SetOfObjectID;extern const nssASN1Template *nssASN1Template_SetOfOctetString;extern const nssASN1Template *nssASN1Template_SetOfPrintableString;extern const nssASN1Template *nssASN1Template_SetOfT61String;extern const nssASN1Template *nssASN1Template_SetOfUniversalString;extern const nssASN1Template *nssASN1Template_SetOfUTCTime;extern const nssASN1Template *nssASN1Template_SetOfUTF8String;extern const nssASN1Template *nssASN1Template_SetOfVisibleString;/* * */NSS_EXTERN NSSUTF8 *nssUTF8_CreateFromBER(  NSSArena *arenaOpt,  nssStringType type,  NSSBER *berData);NSS_EXTERN NSSDER *nssUTF8_GetDEREncoding(  NSSArena *arenaOpt,  /* Should have an NSSDER *rvOpt */  nssStringType type,  const NSSUTF8 *string);PR_END_EXTERN_C#endif /* ASN1_H */

⌨️ 快捷键说明

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