Leaked source code of windows server 2003
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.

156 lines
4.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: ossconv.h
  8. //
  9. // Contents: Conversion APIs to/from OSS ASN.1 data structures
  10. //
  11. // APIs: OssConvToObjectIdentifier
  12. // OssConvFromObjectIdentifier
  13. // OssConvToUTCTime
  14. // OssConvFromUTCTime
  15. // OssConvToGeneralizedTime
  16. // OssConvFromGeneralizedTime
  17. // OssConvToChoiceOfTime
  18. // OssConvFromChoiceOfTime
  19. //
  20. // Notes: According to the <draft-ietf-pkix-ipki-part1-03.txt> :
  21. // For UTCTime. Where YY is greater than 50, the year shall
  22. // be interpreted as 19YY. Where YY is less than or equal to
  23. // 50, the year shall be interpreted as 20YY.
  24. //
  25. // History: 28-Mar-96 philh created
  26. //
  27. //--------------------------------------------------------------------------
  28. #ifndef __OSSCONV_H__
  29. #define __OSSCONV_H__
  30. #include "asn1hdr.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. //+-------------------------------------------------------------------------
  35. // Convert the ascii string ("1.2.9999") to OSS's Object Identifier
  36. // represented as an array of unsigned longs.
  37. //
  38. // Returns TRUE for a successful conversion.
  39. //--------------------------------------------------------------------------
  40. BOOL
  41. WINAPI
  42. OssConvToObjectIdentifier(
  43. IN LPCSTR pszObjId,
  44. IN OUT unsigned short *pCount,
  45. OUT unsigned long rgulValue[]
  46. );
  47. //+-------------------------------------------------------------------------
  48. // Convert from OSS's Object Identifier represented as an array of
  49. // unsigned longs to an ascii string ("1.2.9999").
  50. //
  51. // Returns TRUE for a successful conversion
  52. //--------------------------------------------------------------------------
  53. BOOL
  54. WINAPI
  55. OssConvFromObjectIdentifier(
  56. IN unsigned short Count,
  57. IN unsigned long rgulValue[],
  58. OUT LPSTR pszObjId,
  59. IN OUT DWORD *pcbObjId
  60. );
  61. //+-------------------------------------------------------------------------
  62. // Convert FILETIME to OSS's UTCTime.
  63. //
  64. // Returns TRUE for a successful conversion
  65. //--------------------------------------------------------------------------
  66. BOOL
  67. WINAPI
  68. OssConvToUTCTime(
  69. IN LPFILETIME pFileTime,
  70. OUT UTCTime *pOssTime
  71. );
  72. //+-------------------------------------------------------------------------
  73. // Convert from OSS's UTCTime to FILETIME.
  74. //
  75. // Returns TRUE for a successful conversion
  76. //--------------------------------------------------------------------------
  77. BOOL
  78. WINAPI
  79. OssConvFromUTCTime(
  80. IN UTCTime *pOssTime,
  81. OUT LPFILETIME pFileTime
  82. );
  83. //+-------------------------------------------------------------------------
  84. // Convert FILETIME to OSS's GeneralizedTime.
  85. //
  86. // Returns TRUE for a successful conversion
  87. //--------------------------------------------------------------------------
  88. BOOL
  89. WINAPI
  90. OssConvToGeneralizedTime(
  91. IN LPFILETIME pFileTime,
  92. OUT GeneralizedTime *pOssTime
  93. );
  94. //+-------------------------------------------------------------------------
  95. // Convert from OSS's GeneralizedTime to FILETIME.
  96. //
  97. // Returns TRUE for a successful conversion
  98. //--------------------------------------------------------------------------
  99. BOOL
  100. WINAPI
  101. OssConvFromGeneralizedTime(
  102. IN GeneralizedTime *pOssTime,
  103. OUT LPFILETIME pFileTime
  104. );
  105. //+-------------------------------------------------------------------------
  106. // Convert FILETIME to OSS's UTCTime or GeneralizedTime.
  107. //
  108. // If 1950 < FILETIME < 2005, then UTCTime is chosen. Otherwise,
  109. // GeneralizedTime is chosen. GeneralizedTime values shall not include
  110. // fractional seconds.
  111. //
  112. // Returns TRUE for a successful conversion
  113. //
  114. // Note, in asn1hdr.h, UTCTime has same typedef as GeneralizedTime.
  115. //--------------------------------------------------------------------------
  116. BOOL
  117. WINAPI
  118. OssConvToChoiceOfTime(
  119. IN LPFILETIME pFileTime,
  120. OUT WORD *pwChoice,
  121. OUT GeneralizedTime *pOssTime
  122. );
  123. #define OSS_UTC_TIME_CHOICE 1
  124. #define OSS_GENERALIZED_TIME_CHOICE 2
  125. //+-------------------------------------------------------------------------
  126. // Convert from OSS's UTCTime or GeneralizedTime to FILETIME.
  127. //
  128. // Returns TRUE for a successful conversion.
  129. //
  130. // Note, in asn1hdr.h, UTCTime has same typedef as GeneralizedTime.
  131. //--------------------------------------------------------------------------
  132. BOOL
  133. WINAPI
  134. OssConvFromChoiceOfTime(
  135. IN WORD wChoice,
  136. IN GeneralizedTime *pOssTime,
  137. OUT LPFILETIME pFileTime
  138. );
  139. #ifdef __cplusplus
  140. } // Balance extern "C" above
  141. #endif
  142. #endif