PageRenderTime 97ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/p12t.h

http://firefox-mac-pdf.googlecode.com/
C Header | 187 lines | 103 code | 29 blank | 55 comment | 0 complexity | 7c2609e2f818853232e168e3fe353a2f MD5 | raw file
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is the Netscape security libraries.
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Netscape Communications Corporation.
  18. * Portions created by the Initial Developer are Copyright (C) 1994-2000
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. *
  23. * Alternatively, the contents of this file may be used under the terms of
  24. * either the GNU General Public License Version 2 or later (the "GPL"), or
  25. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26. * in which case the provisions of the GPL or the LGPL are applicable instead
  27. * of those above. If you wish to allow use of your version of this file only
  28. * under the terms of either the GPL or the LGPL, and not to allow others to
  29. * use your version of this file under the terms of the MPL, indicate your
  30. * decision by deleting the provisions above and replace them with the notice
  31. * and other provisions required by the GPL or the LGPL. If you do not delete
  32. * the provisions above, a recipient may use your version of this file under
  33. * the terms of any one of the MPL, the GPL or the LGPL.
  34. *
  35. * ***** END LICENSE BLOCK ***** */
  36. #ifndef _P12T_H_
  37. #define _P12T_H_
  38. #include "secoid.h"
  39. #include "key.h"
  40. #include "pkcs11.h"
  41. #include "secpkcs7.h"
  42. #include "secdig.h" /* for SGNDigestInfo */
  43. #include "pkcs12t.h"
  44. #define SEC_PKCS12_VERSION 3
  45. /* structure declarations */
  46. typedef struct sec_PKCS12PFXItemStr sec_PKCS12PFXItem;
  47. typedef struct sec_PKCS12MacDataStr sec_PKCS12MacData;
  48. typedef struct sec_PKCS12AuthenticatedSafeStr sec_PKCS12AuthenticatedSafe;
  49. typedef struct sec_PKCS12SafeContentsStr sec_PKCS12SafeContents;
  50. typedef struct sec_PKCS12SafeBagStr sec_PKCS12SafeBag;
  51. typedef struct sec_PKCS12PKCS8ShroudedKeyBagStr sec_PKCS12PKCS8ShroudedKeyBag;
  52. typedef struct sec_PKCS12CertBagStr sec_PKCS12CertBag;
  53. typedef struct sec_PKCS12CRLBagStr sec_PKCS12CRLBag;
  54. typedef struct sec_PKCS12SecretBag sec_PKCS12SecretBag;
  55. typedef struct sec_PKCS12AttributeStr sec_PKCS12Attribute;
  56. struct sec_PKCS12CertBagStr {
  57. /* what type of cert is stored? */
  58. SECItem bagID;
  59. /* certificate information */
  60. union {
  61. SECItem x509Cert;
  62. SECItem SDSICert;
  63. } value;
  64. };
  65. struct sec_PKCS12CRLBagStr {
  66. /* what type of cert is stored? */
  67. SECItem bagID;
  68. /* certificate information */
  69. union {
  70. SECItem x509CRL;
  71. } value;
  72. };
  73. struct sec_PKCS12SecretBag {
  74. /* what type of secret? */
  75. SECItem secretType;
  76. /* secret information. ssshhhh be vewy vewy quiet. */
  77. SECItem secretContent;
  78. };
  79. struct sec_PKCS12AttributeStr {
  80. SECItem attrType;
  81. SECItem **attrValue;
  82. };
  83. struct sec_PKCS12SafeBagStr {
  84. /* What type of bag are we using? */
  85. SECItem safeBagType;
  86. /* Dependent upon the type of bag being used. */
  87. union {
  88. SECKEYPrivateKeyInfo *pkcs8KeyBag;
  89. SECKEYEncryptedPrivateKeyInfo *pkcs8ShroudedKeyBag;
  90. sec_PKCS12CertBag *certBag;
  91. sec_PKCS12CRLBag *crlBag;
  92. sec_PKCS12SecretBag *secretBag;
  93. sec_PKCS12SafeContents *safeContents;
  94. } safeBagContent;
  95. sec_PKCS12Attribute **attribs;
  96. /* used locally */
  97. SECOidData *bagTypeTag;
  98. PRArenaPool *arena;
  99. unsigned int nAttribs;
  100. /* used for validation/importing */
  101. PRBool problem, noInstall, validated, hasKey, unused, installed;
  102. int error;
  103. PRBool swapUnicodeBytes;
  104. PK11SlotInfo *slot;
  105. SECItem *pwitem;
  106. PRBool oldBagType;
  107. SECPKCS12TargetTokenCAs tokenCAs;
  108. };
  109. struct sec_PKCS12SafeContentsStr {
  110. sec_PKCS12SafeBag **safeBags;
  111. SECItem **encodedSafeBags;
  112. /* used locally */
  113. PRArenaPool *arena;
  114. unsigned int bagCount;
  115. };
  116. struct sec_PKCS12MacDataStr {
  117. SGNDigestInfo safeMac;
  118. SECItem macSalt;
  119. SECItem iter;
  120. };
  121. struct sec_PKCS12PFXItemStr {
  122. SECItem version;
  123. /* Content type will either be Data (password integrity mode)
  124. * or signedData (public-key integrity mode)
  125. */
  126. SEC_PKCS7ContentInfo *authSafe;
  127. SECItem encodedAuthSafe;
  128. /* Only present in password integrity mode */
  129. sec_PKCS12MacData macData;
  130. SECItem encodedMacData;
  131. };
  132. struct sec_PKCS12AuthenticatedSafeStr {
  133. /* Content type will either be encryptedData (password privacy mode)
  134. * or envelopedData (public-key privacy mode)
  135. */
  136. SEC_PKCS7ContentInfo **safes;
  137. SECItem **encodedSafes;
  138. /* used locally */
  139. unsigned int safeCount;
  140. SECItem dummySafe;
  141. };
  142. extern const SEC_ASN1Template sec_PKCS12PFXItemTemplate[];
  143. extern const SEC_ASN1Template sec_PKCS12MacDataTemplate[];
  144. extern const SEC_ASN1Template sec_PKCS12AuthenticatedSafeTemplate[];
  145. extern const SEC_ASN1Template sec_PKCS12SafeContentsTemplate[];
  146. extern const SEC_ASN1Template sec_PKCS12SafeContentsDecodeTemplate[];
  147. extern const SEC_ASN1Template sec_PKCS12NestedSafeContentsDecodeTemplate[];
  148. extern const SEC_ASN1Template sec_PKCS12CertBagTemplate[];
  149. extern const SEC_ASN1Template sec_PKCS12CRLBagTemplate[];
  150. extern const SEC_ASN1Template sec_PKCS12SecretBagTemplate[];
  151. extern const SEC_ASN1Template sec_PKCS12PointerToCertBagTemplate[];
  152. extern const SEC_ASN1Template sec_PKCS12PointerToCRLBagTemplate[];
  153. extern const SEC_ASN1Template sec_PKCS12PointerToSecretBagTemplate[];
  154. extern const SEC_ASN1Template sec_PKCS12PointerToSafeContentsTemplate[];
  155. extern const SEC_ASN1Template sec_PKCS12AttributeTemplate[];
  156. extern const SEC_ASN1Template sec_PKCS12PointerToContentInfoTemplate[];
  157. extern const SEC_ASN1Template sec_PKCS12SafeBagTemplate[];
  158. #endif