/security/nss/lib/crmf/crmfit.h

http://github.com/zpao/v8monkey · C Header · 219 lines · 128 code · 23 blank · 68 comment · 0 complexity · defdbf170ee6103a1083be0bb2677cae 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. #ifndef _CRMFIT_H_
  38. #define _CRMFIT_H_
  39. struct CRMFCertReqMessagesStr {
  40. CRMFCertReqMsg **messages;
  41. PRArenaPool *poolp;
  42. };
  43. struct CRMFCertExtensionStr {
  44. SECItem id;
  45. SECItem critical;
  46. SECItem value;
  47. };
  48. struct CRMFOptionalValidityStr {
  49. SECItem notBefore;
  50. SECItem notAfter;
  51. };
  52. struct CRMFCertTemplateStr {
  53. SECItem version;
  54. SECItem serialNumber;
  55. SECAlgorithmID *signingAlg;
  56. CERTName *issuer;
  57. CRMFOptionalValidity *validity;
  58. CERTName *subject;
  59. CERTSubjectPublicKeyInfo *publicKey;
  60. SECItem issuerUID;
  61. SECItem subjectUID;
  62. CRMFCertExtension **extensions;
  63. int numExtensions;
  64. };
  65. struct CRMFCertIDStr {
  66. SECItem issuer; /* General Name */
  67. SECItem serialNumber; /*INTEGER*/
  68. };
  69. struct CRMFEncryptedValueStr {
  70. SECAlgorithmID *intendedAlg;
  71. SECAlgorithmID *symmAlg;
  72. SECItem encSymmKey; /*BIT STRING */
  73. SECAlgorithmID *keyAlg;
  74. SECItem valueHint; /*OCTET STRING */
  75. SECItem encValue; /*BIT STRING */
  76. };
  77. /*
  78. * The field derValue will contain the actual der
  79. * to include in the encoding or that was read in
  80. * from a der blob.
  81. */
  82. struct CRMFEncryptedKeyStr {
  83. union {
  84. SEC_PKCS7ContentInfo *envelopedData;
  85. CRMFEncryptedValue encryptedValue;
  86. } value;
  87. CRMFEncryptedKeyChoice encKeyChoice;
  88. SECItem derValue;
  89. };
  90. /* ASN1 must only have one of the following 3 options. */
  91. struct CRMFPKIArchiveOptionsStr {
  92. union {
  93. CRMFEncryptedKey encryptedKey;
  94. SECItem keyGenParameters;
  95. SECItem archiveRemGenPrivKey; /* BOOLEAN */
  96. } option;
  97. CRMFPKIArchiveOptionsType archOption;
  98. };
  99. struct CRMFPKIPublicationInfoStr {
  100. SECItem action; /* Possible values */
  101. /* dontPublish (0), pleasePublish (1) */
  102. CRMFSinglePubInfo **pubInfos;
  103. };
  104. struct CRMFControlStr {
  105. SECOidTag tag;
  106. SECItem derTag;
  107. SECItem derValue;
  108. /* These will be C structures used to represent the various
  109. * options. Values that can't be stored as der right away.
  110. * After creating these structures, we'll place their der
  111. * encoding in derValue so the encoder knows how to get to
  112. * it.
  113. */
  114. union {
  115. CRMFCertID oldCertId;
  116. CRMFPKIArchiveOptions archiveOptions;
  117. CRMFPKIPublicationInfo pubInfo;
  118. CRMFProtocolEncrKey protEncrKey;
  119. } value;
  120. };
  121. struct CRMFCertRequestStr {
  122. SECItem certReqId;
  123. CRMFCertTemplate certTemplate;
  124. CRMFControl **controls;
  125. /* The following members are used by the internal implementation, but
  126. * are not part of the encoding.
  127. */
  128. PRArenaPool *poolp;
  129. PRUint32 requestID; /* This is the value that will be encoded into
  130. * the certReqId field.
  131. */
  132. };
  133. struct CRMFAttributeStr {
  134. SECItem derTag;
  135. SECItem derValue;
  136. };
  137. struct CRMFCertReqMsgStr {
  138. CRMFCertRequest *certReq;
  139. CRMFProofOfPossession *pop;
  140. CRMFAttribute **regInfo;
  141. SECItem derPOP;
  142. /* This arena will be used for allocating memory when decoding.
  143. */
  144. PRArenaPool *poolp;
  145. PRBool isDecoded;
  146. };
  147. struct CRMFPOPOSigningKeyInputStr {
  148. /* ASN1 must have only one of the next 2 options */
  149. union {
  150. SECItem sender; /*General Name*/
  151. CRMFPKMACValue *publicKeyMAC;
  152. }authInfo;
  153. CERTSubjectPublicKeyInfo publicKey;
  154. };
  155. struct CRMFPOPOSigningKeyStr {
  156. SECItem derInput; /*If in the future we support
  157. *POPOSigningKeyInput, this will
  158. *a C structure representation
  159. *instead.
  160. */
  161. SECAlgorithmID *algorithmIdentifier;
  162. SECItem signature; /* This is a BIT STRING. Remember */
  163. }; /* that when interpreting. */
  164. /* ASN1 must only choose one of these members */
  165. struct CRMFPOPOPrivKeyStr {
  166. union {
  167. SECItem thisMessage; /* BIT STRING */
  168. SECItem subsequentMessage; /*INTEGER*/
  169. SECItem dhMAC; /*BIT STRING*/
  170. } message;
  171. CRMFPOPOPrivKeyChoice messageChoice;
  172. };
  173. /* ASN1 must only have one of these options. */
  174. struct CRMFProofOfPossessionStr {
  175. union {
  176. SECItem raVerified;
  177. CRMFPOPOSigningKey signature;
  178. CRMFPOPOPrivKey keyEncipherment;
  179. CRMFPOPOPrivKey keyAgreement;
  180. } popChoice;
  181. CRMFPOPChoice popUsed; /*Not part of encoding*/
  182. };
  183. struct CRMFPKMACValueStr {
  184. SECAlgorithmID algID;
  185. SECItem value; /*BIT STRING*/
  186. };
  187. struct CRMFSinglePubInfoStr {
  188. SECItem pubMethod; /* Possible Values:
  189. * dontCare (0)
  190. * x500 (1)
  191. * web (2)
  192. * ldap (3)
  193. */
  194. CERTGeneralName *pubLocation; /* General Name */
  195. };
  196. #endif /* _CRMFIT_H_ */