Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.5 KiB

  1. #include "algid.h"
  2. #ifndef _ENCODE_H_
  3. #define _ENCODE_H_
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* tag definitions for ASN.1 encoding decoding */
  8. #define INTEGER_TAG 0x02
  9. #define CHAR_STRING_TAG 0x16
  10. #define OCTET_STRING_TAG 0x04
  11. #define BIT_STRING_TAG 0x03
  12. #define UTCTIME_TAG 0x17
  13. #define SEQUENCE_TAG 0x36
  14. #define SET_OF_TAG 0x11
  15. #define OBJECT_ID_TAG 0x06
  16. /* definitions of maximum lengths needed for the ASN.1 encoded
  17. form of some of the common fields in a certificate */
  18. #define MAXVALIDITYLEN 0x24
  19. #define MAXKEYINFOLEN 0x50
  20. #define MAXALGIDLEN 0x0A
  21. #define MAXOBJIDLEN 0x0A
  22. #define MAXNAMEVALUELEN 0x40
  23. #define UTCTIMELEN 0x0F
  24. #define MAXPUBKEYDATALEN 0x30
  25. #define VERSIONLEN 0x03
  26. #define MAXENCODEDSIGLEN 0x30
  27. #define MAXHEADERLEN 0x08
  28. #define MINHEADERLEN 0x03
  29. #define MAXTIMELEN 0x20
  30. /* definitions for scrubbing memory */
  31. #define ALLBITSOFF 0x00
  32. #define ALLBITSON 0xFF
  33. /* prototypes for the functions in encode.c */
  34. long EncodeLength (BYTE *pbEncoded, DWORD dwLen, BOOL Writeflag);
  35. long EncodeAlgid (BYTE *pbEncoded, ALG_ID Algid, BOOL Writeflag);
  36. long EncodeInteger (BYTE *pbEncoded, CONST BYTE *pbInt, DWORD dwLen, BOOL Writeflag);
  37. long EncodeString (BYTE *pbEncoded, CONST BYTE *pbStr, DWORD dwLen, BOOL Writeflag);
  38. long EncodeOctetString (BYTE *pbEncoded, CONST BYTE *pbStr, DWORD dwLen, BOOL Writeflag);
  39. long EncodeBitString (BYTE *pbEncoded, CONST BYTE *pbStr, DWORD dwLen, BOOL Writeflag);
  40. long EncodeUTCTime (BYTE *pbEncoded, time_t Time, BOOL Writeflag);
  41. long EncodeHeader (BYTE *pbEncoded, DWORD dwLen, BOOL Writeflag);
  42. long EncodeSetOfHeader (BYTE *pbEncoded, DWORD dwLen, BOOL Writeflag);
  43. long EncodeName (BYTE *pbEncoded, CONST BYTE *pbName, DWORD dwLen, BOOL Writeflag);
  44. long DecodeLength (DWORD *pdwLen, CONST BYTE *pbEncoded);
  45. long DecodeAlgid (ALG_ID *pAlgid, CONST BYTE *pbEncoded, BOOL Writeflag);
  46. long DecodeHeader (DWORD *pdwLen, CONST BYTE *pbEncoded);
  47. long DecodeSetOfHeader (DWORD *pdwLen, CONST BYTE *pbEncoded);
  48. long DecodeInteger (BYTE *pbInt, DWORD *pdwLen, CONST BYTE *pbEncoded, BOOL Writeflag);
  49. long DecodeString (BYTE *pbStr, DWORD *pdwLen, CONST BYTE *pbEncoded, BOOL Writeflag);
  50. long DecodeOctetString (BYTE *pbStr, DWORD *pdwLen, CONST BYTE *pbEncoded, BOOL Writeflag);
  51. long DecodeBitString (BYTE *pbStr, DWORD *pdwLen, CONST BYTE *pbEncoded, BOOL Writeflag);
  52. long DecodeUTCTime (time_t *pTime, CONST BYTE *pbEncoded, BOOL Writeflag);
  53. long DecodeName (BYTE *pbName, DWORD *pdwLen, CONST BYTE *pbEncoded, BOOL Writeflag);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif // _ENCODE_H_