PageRenderTime 113ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/crmft.h

http://firefox-mac-pdf.googlecode.com/
C Header | 220 lines | 106 code | 21 blank | 93 comment | 0 complexity | bcdada24135a430e88bac3536cfc1b69 MD5 | raw file
  1. /* -*- Mode: C; tab-width: 8 -*-*/
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is the Netscape security libraries.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1994-2000
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /* Header file with all of the structures and types that will be exported
  38. * by the security library for implementation of CRMF.
  39. */
  40. #ifndef _CRMFT_H_
  41. #define _CRMFT_H_
  42. /* Use these enumerated values for adding fields to the certificate request */
  43. typedef enum {
  44. crmfVersion = 0,
  45. crmfSerialNumber = 1,
  46. crmfSigningAlg = 2,
  47. crmfIssuer = 3,
  48. crmfValidity = 4,
  49. crmfSubject = 5,
  50. crmfPublicKey = 6,
  51. crmfIssuerUID = 7,
  52. crmfSubjectUID = 8,
  53. crmfExtension = 9
  54. } CRMFCertTemplateField;
  55. /*
  56. * An enumeration for the different types of controls.
  57. */
  58. typedef enum {
  59. crmfNoControl = 0,
  60. crmfRegTokenControl = 1,
  61. crmfAuthenticatorControl = 2,
  62. crmfPKIPublicationInfoControl = 3,
  63. crmfPKIArchiveOptionsControl = 4,
  64. crmfOldCertIDControl = 5,
  65. crmfProtocolEncrKeyControl = 6
  66. } CRMFControlType;
  67. /*
  68. * The possible values that are passed into CRMF_CreatePKIPublicationInfo
  69. */
  70. typedef enum {
  71. crmfDontPublish = 0,
  72. crmfPleasePublish = 1
  73. } CRMFPublicationAction;
  74. /*
  75. * An enumeration for the possible for pubMethod which is a part of
  76. * the SinglePubInfo ASN1 type.
  77. */
  78. typedef enum {
  79. crmfDontCare = 0,
  80. crmfX500 = 1,
  81. crmfWeb = 2,
  82. crmfLdap = 3
  83. } CRMFPublicationMethod;
  84. /*
  85. * An enumeration for the different options for PKIArchiveOptions type.
  86. */
  87. typedef enum {
  88. crmfNoArchiveOptions = 0,
  89. crmfEncryptedPrivateKey = 1,
  90. crmfKeyGenParameters = 2,
  91. crmfArchiveRemGenPrivKey = 3
  92. } CRMFPKIArchiveOptionsType;
  93. /*
  94. * An enumeration for the different options for ProofOfPossession
  95. */
  96. typedef enum {
  97. crmfNoPOPChoice = 0,
  98. crmfRAVerified = 1,
  99. crmfSignature = 2,
  100. crmfKeyEncipherment = 3,
  101. crmfKeyAgreement = 4
  102. } CRMFPOPChoice;
  103. /*
  104. * An enumertion type for options for the authInfo field of the
  105. * CRMFPOPOSigningKeyInput structure.
  106. */
  107. typedef enum {
  108. crmfSender = 0,
  109. crmfPublicKeyMAC = 1
  110. } CRMFPOPOSkiInputAuthChoice;
  111. /*
  112. * An enumeration for the SubsequentMessage Options.
  113. */
  114. typedef enum {
  115. crmfNoSubseqMess = 0,
  116. crmfEncrCert = 1,
  117. crmfChallengeResp = 2
  118. } CRMFSubseqMessOptions;
  119. /*
  120. * An enumeration for the choice used by POPOPrivKey.
  121. */
  122. typedef enum {
  123. crmfNoMessage = 0,
  124. crmfThisMessage = 1,
  125. crmfSubsequentMessage = 2,
  126. crmfDHMAC = 3
  127. } CRMFPOPOPrivKeyChoice;
  128. /*
  129. * An enumeration for the choices for the EncryptedKey type.
  130. */
  131. typedef enum {
  132. crmfNoEncryptedKeyChoice = 0,
  133. crmfEncryptedValueChoice = 1,
  134. crmfEnvelopedDataChoice = 2
  135. } CRMFEncryptedKeyChoice;
  136. /*
  137. * TYPE: CRMFEncoderOutputCallback
  138. * This function type defines a prototype for a function that the CRMF
  139. * library expects when encoding is performed.
  140. *
  141. * ARGUMENTS:
  142. * arg
  143. * This will be a pointer the user passed into an encoding function.
  144. * The user of the library is free to use this pointer in any way.
  145. * The most common use is to keep around a buffer for writing out
  146. * the DER encoded bytes.
  147. * buf
  148. * The DER encoded bytes that should be written out.
  149. * len
  150. * The number of DER encoded bytes to write out.
  151. *
  152. */
  153. typedef void (*CRMFEncoderOutputCallback) (void *arg,
  154. const char *buf,
  155. unsigned long len);
  156. /*
  157. * Type for the function that gets a password. Just in case we ever
  158. * need to support publicKeyMAC for POPOSigningKeyInput
  159. */
  160. typedef SECItem* (*CRMFMACPasswordCallback) (void *arg);
  161. typedef struct CRMFOptionalValidityStr CRMFOptionalValidity;
  162. typedef struct CRMFValidityCreationInfoStr CRMFGetValidity;
  163. typedef struct CRMFCertTemplateStr CRMFCertTemplate;
  164. typedef struct CRMFCertRequestStr CRMFCertRequest;
  165. typedef struct CRMFCertReqMsgStr CRMFCertReqMsg;
  166. typedef struct CRMFCertReqMessagesStr CRMFCertReqMessages;
  167. typedef struct CRMFProofOfPossessionStr CRMFProofOfPossession;
  168. typedef struct CRMFPOPOSigningKeyStr CRMFPOPOSigningKey;
  169. typedef struct CRMFPOPOSigningKeyInputStr CRMFPOPOSigningKeyInput;
  170. typedef struct CRMFPOPOPrivKeyStr CRMFPOPOPrivKey;
  171. typedef struct CRMFPKIPublicationInfoStr CRMFPKIPublicationInfo;
  172. typedef struct CRMFSinglePubInfoStr CRMFSinglePubInfo;
  173. typedef struct CRMFPKIArchiveOptionsStr CRMFPKIArchiveOptions;
  174. typedef struct CRMFEncryptedKeyStr CRMFEncryptedKey;
  175. typedef struct CRMFEncryptedValueStr CRMFEncryptedValue;
  176. typedef struct CRMFCertIDStr CRMFCertID;
  177. typedef struct CRMFCertIDStr CRMFOldCertID;
  178. typedef CERTSubjectPublicKeyInfo CRMFProtocolEncrKey;
  179. typedef struct CRMFValidityCreationInfoStr CRMFValidityCreationInfo;
  180. typedef struct CRMFCertExtCreationInfoStr CRMFCertExtCreationInfo;
  181. typedef struct CRMFPKMACValueStr CRMFPKMACValue;
  182. typedef struct CRMFAttributeStr CRMFAttribute;
  183. typedef struct CRMFControlStr CRMFControl;
  184. typedef CERTGeneralName CRMFGeneralName;
  185. typedef struct CRMFCertExtensionStr CRMFCertExtension;
  186. struct CRMFValidityCreationInfoStr {
  187. PRTime *notBefore;
  188. PRTime *notAfter;
  189. };
  190. struct CRMFCertExtCreationInfoStr {
  191. CRMFCertExtension **extensions;
  192. int numExtensions;
  193. };
  194. /*
  195. * Some ASN1 Templates that may be needed.
  196. */
  197. extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[];
  198. extern const SEC_ASN1Template CRMFCertRequestTemplate[];
  199. #endif /*_CRMFT_H_*/