PageRenderTime 55ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/crmf.h

http://firefox-mac-pdf.googlecode.com/
C Header | 1782 lines | 189 code | 91 blank | 1502 comment | 0 complexity | b45cf1fafb5a2c8ffe54e5513c925a8d 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 _CRMF_H_
  38. #define _CRMF_H_
  39. #include "seccomon.h"
  40. #include "cert.h"
  41. #include "crmft.h"
  42. #include "secoid.h"
  43. #include "secpkcs7.h"
  44. SEC_BEGIN_PROTOS
  45. /*
  46. * FUNCTION: CRMF_EncodeCertReqMsg
  47. * INPUTS:
  48. * inCertReqMsg
  49. * The Certificate Request Message to be encoded.
  50. * fn
  51. * A Callback function that the ASN1 encoder calls whenever
  52. * the encoder wants to write out some DER encoded bytes.
  53. * arg
  54. * An opaque pointer that gets passed to the function fn
  55. * OUTPUT:
  56. * The function fn will be called multiple times. Look at the
  57. * comments in crmft.h where the CRMFEncoderOutputCallback type is
  58. * defined for information on proper behavior of the function fn.
  59. * RETURN:
  60. * SECSuccess if encoding was successful. Any other return value
  61. * indicates an error occurred during encoding.
  62. */
  63. extern SECStatus
  64. CRMF_EncodeCertReqMsg (CRMFCertReqMsg *inCertReqMsg,
  65. CRMFEncoderOutputCallback fn,
  66. void *arg);
  67. /*
  68. * FUNCTION: CRMF_EncoderCertRequest
  69. * INPUTS:
  70. * inCertReq
  71. * The Certificate Request to be encoded.
  72. * fn
  73. * A Callback function that the ASN1 encoder calls whenever
  74. * the encoder wants to write out some DER encoded bytes.
  75. * arg
  76. * An opaque pointer that gets passed to the function fn.
  77. * OUTPUT:
  78. * The function fn will be called, probably multiple times whenever
  79. * the ASN1 encoder wants to write out DER-encoded bytes. Look at the
  80. * comments in crmft.h where the CRMFEncoderOuputCallback type is
  81. * defined for information on proper behavior of the funciton fn.
  82. * RETURN:
  83. * SECSuccess if encoding was successful. Any other return value
  84. * indicates an error occured during encoding.
  85. */
  86. extern SECStatus CRMF_EncodeCertRequest (CRMFCertRequest *inCertReq,
  87. CRMFEncoderOutputCallback fn,
  88. void *arg);
  89. /*
  90. * FUNCTION: CRMF_EncodeCertReqMessages
  91. * INPUTS:
  92. * inCertReqMsgs
  93. * An array of pointers to the Certificate Request Messages
  94. * to encode. The user must place a NULL pointer in the index
  95. * after the last message to be encoded. When the library runs
  96. * into the NULL pointer, the library assumes there are no more
  97. * messages to encode.
  98. * fn
  99. * A Callback function that the ASN1 encoder calls whenever
  100. * the encoder wants to write out some DER encoded byts.
  101. * arg
  102. * An opaque pointer that gets passed to the function fn.
  103. *
  104. * NOTES:
  105. * The parameter inCertReqMsgs needs to be an array with a NULL pointer
  106. * to signal the end of messages. An array in the form of
  107. * {m1, m2, m3, NULL, m4, ...} will only encode the messages m1, m2, and
  108. * m3. All messages from m4 on will not be looked at by the library.
  109. *
  110. * OUTPUT:
  111. * The function fn will be called, probably multiple times. Look at the
  112. * comments in crmft.h where the CRMFEncoderOuputCallback type is
  113. * defined for information on proper behavior of the funciton fn.
  114. *
  115. * RETURN:
  116. * SECSuccess if encoding the Certificate Request Messages was successful.
  117. * Any other return value indicates an error occurred while encoding the
  118. * certificate request messages.
  119. */
  120. extern SECStatus
  121. CRMF_EncodeCertReqMessages(CRMFCertReqMsg **inCertReqMsgs,
  122. CRMFEncoderOutputCallback fn,
  123. void *arg);
  124. /*
  125. * FUNCTION: CRMF_CreateCertReqMsg
  126. * INPUTS:
  127. * NONE
  128. * OUTPUT:
  129. * An empty CRMF Certificate Request Message.
  130. * Before encoding this message, the user must set
  131. * the ProofOfPossession field and the certificate
  132. * request which are necessary for the full message.
  133. * After the user no longer needs this CertReqMsg,
  134. * the user must call CRMF_DestroyCertReqMsg to free
  135. * all memory associated with the Certificate Request
  136. * Message.
  137. * RETURN:
  138. * A pointer to a Certificate Request Message. The user
  139. * must pass the return value of this function to
  140. * CRMF_DestroyCertReqMsg after the Certificate Request
  141. * Message is no longer necessary.
  142. */
  143. extern CRMFCertReqMsg* CRMF_CreateCertReqMsg(void);
  144. /*
  145. * FUNCTION: CRMF_DestroyCertReqMsg
  146. * INPUTS:
  147. * inCertReqMsg
  148. * The Certificate Request Message to destroy.
  149. * NOTES:
  150. * This function frees all the memory used for the Certificate
  151. * Request Message and all the memory used in making copies of
  152. * fields of elelments of the message, eg. the Proof Of Possession
  153. * filed and the Cetificate Request.
  154. * RETURN:
  155. * SECSuccess if destruction was successful. Any other return value
  156. * indicates an error while trying to free the memory associated
  157. * with inCertReqMsg.
  158. *
  159. */
  160. extern SECStatus CRMF_DestroyCertReqMsg(CRMFCertReqMsg *inCertReqMsg);
  161. /*
  162. * FUNCTION: CRMF_CertReqMsgSetCertRequest
  163. * INPUTS:
  164. * inCertReqMsg
  165. * The Certificate Request Message that the function will set
  166. * the certificate request for.
  167. * inCertReq
  168. * The Certificate Request that will be added to the Certificate
  169. * Request Message.
  170. * NOTES:
  171. * This function will make a copy of the Certificate Request passed in
  172. * and store it as part of the Certificate Request Message. Therefore,
  173. * the user must not call this function until the Certificate Request
  174. * has been fully built and is ready to be encoded.
  175. * RETURN:
  176. * SECSuccess
  177. * If copying the Certificate as a member of the Certificate
  178. * request message was successful.
  179. * Any other return value indicates a failure to copy the Certificate
  180. * Request and make it a part of the Certificate Request Message.
  181. */
  182. extern SECStatus CRMF_CertReqMsgSetCertRequest(CRMFCertReqMsg *inCertReqMsg,
  183. CRMFCertRequest *inCertReq);
  184. /*
  185. * FUNCTION: CRMF_CreateCertRequest
  186. * INPUTS:
  187. * inRequestID
  188. * The ID that will be associated with this certificate request.
  189. * OUTPUTS:
  190. * A certificate request which only has the requestID set.
  191. * NOTES:
  192. * The user must call the function CRMF_DestroyCertRequest when
  193. * the returned value is no longer needed. This is usually the
  194. * case after fully constructing the Certificate Request and then
  195. * calling the function CRMF_CertReqMsgSetCertRequest.
  196. * RETURN:
  197. * A pointer to the new Certificate Request. A NULL return value
  198. * indicates an error in creating the Certificate Request.
  199. */
  200. extern CRMFCertRequest *CRMF_CreateCertRequest (PRUint32 inRequestID);
  201. /*
  202. * FUNCTION: CRMF_DestroyCertRequest
  203. * INPUTS:
  204. * inCertReq
  205. * The Certificate Request that will be destroyed.
  206. * RETURN:
  207. * SECSuccess
  208. * If freeing the memory associated with the certificate request
  209. * was successful.
  210. * Any other return value indicates an error while trying to free the
  211. * memory.
  212. */
  213. extern SECStatus CRMF_DestroyCertRequest (CRMFCertRequest *inCertReq);
  214. /*
  215. * FUNCTION: CRMF_CreateCertExtension
  216. * INPUTS:
  217. * id
  218. * The SECOidTag to associate with this CertExtension. This must
  219. * correspond to a valid Certificate Extension, if not the function
  220. * will fail.
  221. * isCritical
  222. * A boolean value stating if the extension value is crtical. PR_TRUE
  223. * means the value is crtical. PR_FALSE indicates the value is not
  224. * critical.
  225. * data
  226. * This is the data associated with the extension. The user of the
  227. * library is responsible for making sure the value passed in is a
  228. * valid interpretation of the certificate extension.
  229. * NOTES:
  230. * Use this function to create CRMFCertExtension Structures which will
  231. * then be passed to CRMF_AddFieldToCertTemplate as part of the
  232. * CRMFCertCreationInfo.extensions The user must call
  233. * CRMF_DestroyCertExtension after the extension has been added to a certifcate
  234. * and the extension is no longer needed.
  235. *
  236. * RETURN:
  237. * A pointer to a newly created CertExtension. A return value of NULL
  238. * indicates the id passed in was an invalid certificate extension.
  239. */
  240. extern CRMFCertExtension *CRMF_CreateCertExtension(SECOidTag id,
  241. PRBool isCritical,
  242. SECItem *data);
  243. /*
  244. * FUNCTION: CMRF_DestroyCertExtension
  245. * INPUTS:
  246. * inExtension
  247. * The Cert Extension to destroy
  248. * NOTES:
  249. * Destroy a structure allocated by CRMF_CreateCertExtension.
  250. *
  251. * RETURN:
  252. * SECSuccess if freeing the memory associated with the certificate extension
  253. * was successful. Any other error indicates an error while freeing the
  254. * memory.
  255. */
  256. extern SECStatus CRMF_DestroyCertExtension(CRMFCertExtension *inExtension);
  257. /*
  258. * FUNCTION: CRMF_CertRequestSetTemplateField
  259. * INPUTS:
  260. * inCertReq
  261. * The Certificate Request to operate on.
  262. * inTemplateField
  263. * An enumeration that indicates which field of the Certificate
  264. * template to add.
  265. * data
  266. * A generic pointer that will be type cast according to the
  267. * table under NOTES and used as the key for adding to the
  268. * certificate template;
  269. * NOTES:
  270. *
  271. * Below is a table that tells what type to pass in as data
  272. * depending on the template field one wants to set.
  273. *
  274. * Look in crmft.h for the definition of CRMFCertTemplateField.
  275. *
  276. * In all cases, the library makes copies of the data passed in.
  277. *
  278. * CRMFCertTemplateField Type of data What data means
  279. * --------------------- ------------ ---------------
  280. * crmfVersion long * The version of
  281. * the certificate
  282. * to be created.
  283. *
  284. * crmfSerialNumber long * The serial number
  285. * for the cert to be
  286. * created.
  287. *
  288. * crmfSigningAlg SECAlgorithm * The ASN.1 object ID for
  289. * the algorithm used in encoding
  290. * the certificate.
  291. *
  292. * crmfIssuer CERTName * Certificate Library
  293. * representation of the ASN1 type
  294. * Name from X.509
  295. *
  296. * crmfValidity CRMFValidityCreationInfo * At least one of the two
  297. * fields in the structure must
  298. * be present. A NULL pointer
  299. * in the structure indicates
  300. * that member should not be
  301. * added.
  302. *
  303. * crmfSubject CERTName * Certificate Library
  304. * representation of the ASN1 type
  305. * Name from X.509
  306. *
  307. * crmfPublicKey CERTSubjectPublicKeyInfo * The public key info for the
  308. * certificate being requested.
  309. *
  310. * crmfIssuerUID SECItem * A bit string representation
  311. * of the issuer UID. NOTE: The
  312. * length is the number of bits
  313. * and not the number of bytes.
  314. *
  315. * crmfSubjectUID SECItem* A bit string representation
  316. * of the subject UID. NOTE: The
  317. * length is the number of bits
  318. * and not the number of bytes.
  319. *
  320. * crmfExtension CRMFCertExtCreationInfo * A pointer to the structure
  321. * populated with an array of
  322. * of certificate extensions
  323. * and an integer that tells
  324. * how many elements are in the
  325. * array. Look in crmft.h for
  326. * the definition of
  327. * CRMFCertExtCreationInfo
  328. * RETURN:
  329. * SECSuccess if adding the desired field to the template was successful.
  330. * Any other return value indicates failure when trying to add the field
  331. * to the template.
  332. *
  333. */
  334. extern SECStatus
  335. CRMF_CertRequestSetTemplateField(CRMFCertRequest *inCertReq,
  336. CRMFCertTemplateField inTemplateField,
  337. void *data);
  338. /*
  339. * FUNCTION: CRMF_CertRequestIsFieldPresent
  340. * INPUTS:
  341. * inCertReq
  342. * The certificate request to operate on.
  343. * inTemplateField
  344. * The enumeration for the template field the user wants to query
  345. * about.
  346. * NOTES:
  347. * This function checks to see if the the field associated with inTemplateField
  348. * enumeration is already present in the certificate request passed in.
  349. *
  350. * RETURN:
  351. * The function returns PR_TRUE if the field associated with inTemplateField
  352. * is already present in the certificate request. If the field is not present
  353. * the function returns PR_FALSE.
  354. */
  355. extern PRBool
  356. CRMF_CertRequestIsFieldPresent(CRMFCertRequest *inCertReq,
  357. CRMFCertTemplateField inTemplateField);
  358. /*
  359. * FUNCTION: CRMF_CertRequestIsControlPresent
  360. * INPUTS:
  361. * inCertReq
  362. * The certificate request to operate on.
  363. * inControlType
  364. * The type of control to look for.
  365. * NOTES:
  366. * This function looks at the control present in the certificate request
  367. * and returns PR_TRUE iff a control of type inControlType already exists.
  368. * The CRMF draft does not explicitly state that two controls of the same
  369. * type can not exist within the same request. So the library will not
  370. * cause an error if you try to add a control and one of the same type
  371. * already exists. It is up to the application to ensure that multiple
  372. * controls of the same type do not exist, if that is the desired behavior
  373. * by the application.
  374. *
  375. * RETURN:
  376. * The function returns PR_TRUE if a control of type inControlType already
  377. * exists in the certificate request. If a control of type inControlType
  378. * does not exist, the function will return PR_FALSE.
  379. */
  380. extern PRBool
  381. CRMF_CertRequestIsControlPresent(CRMFCertRequest *inCertReq,
  382. CRMFControlType inControlType);
  383. /*
  384. * FUNCTION: CRMF_CertRequestSetRegTokenControl
  385. * INPUTS:
  386. * inCertReq
  387. * The Certificate Request to operate on.
  388. * value
  389. * The UTF8 value which will be the Registration Token Control
  390. * for this Certificate Request.
  391. * NOTES:
  392. * The library does no verification that the value passed in is
  393. * a valid UTF8 value. The caller must make sure of this in order
  394. * to get an encoding that is valid. The library will ultimately
  395. * encode this value as it was passed in.
  396. * RETURN:
  397. * SECSucces on successful addition of the Registration Token Control.
  398. * Any other return value indicates an unsuccessful attempt to add the
  399. * control.
  400. *
  401. */
  402. extern SECStatus CRMF_CertRequestSetRegTokenControl(CRMFCertRequest *inCertReq,
  403. SECItem *value);
  404. /*
  405. * FUNCTION: CRMF_CertRequestSetAuthenticatorControl
  406. * INPUTS:
  407. * inCertReq
  408. * The Certificate Request to operate on.
  409. * value
  410. * The UTF8 value that will become the Authenticator Control
  411. * for the passed in Certificate Request.
  412. * NOTES:
  413. * The library does no verification that the value passed in is
  414. * a valid UTF8 value. The caller must make sure of this in order
  415. * to get an encoding that is valid. The library will ultimately
  416. * encode this value as it was passed in.
  417. * RETURN:
  418. * SECSucces on successful addition of the Authenticator Control.
  419. * Any other return value indicates an unsuccessful attempt to add the
  420. * control.
  421. */
  422. extern SECStatus
  423. CRMF_CertRequestSetAuthenticatorControl (CRMFCertRequest *inCertReq,
  424. SECItem *value);
  425. /*
  426. * FUNCTION: CRMF_CreateEncryptedKeyWithencryptedValue
  427. * INPUTS:
  428. * inPrivKey
  429. * This is the private key associated with a certificate that is
  430. * being requested. This structure will eventually wind up as
  431. * a part of the PKIArchiveOptions Control.
  432. * inCACert
  433. * This is the certificate for the CA that will be receiving the
  434. * certificate request for the private key passed in.
  435. * OUTPUT:
  436. * A CRMFEncryptedKey that can ultimately be used as part of the
  437. * PKIArchiveOptions Control.
  438. *
  439. * RETURN:
  440. * A pointer to a CRMFEncyptedKey. A NULL return value indicates an erro
  441. * during the creation of the encrypted key.
  442. */
  443. extern CRMFEncryptedKey*
  444. CRMF_CreateEncryptedKeyWithEncryptedValue(SECKEYPrivateKey *inPrivKey,
  445. CERTCertificate *inCACert);
  446. /*
  447. * FUNCTION: CRMF_DestroyEncryptedKey
  448. * INPUTS:
  449. * inEncrKey
  450. * The CRMFEncryptedKey to be destroyed.
  451. * NOTES:
  452. * Frees all memory associated with the CRMFEncryptedKey passed in.
  453. * RETURN:
  454. * SECSuccess if freeing the memory was successful. Any other return
  455. * value indicates an error while freeig the memroy.
  456. */
  457. extern SECStatus CRMF_DestroyEncryptedKey(CRMFEncryptedKey *inEncrKey);
  458. /*
  459. * FUNCTION: CRMF_CreatePKIArchiveOptions
  460. * INPUTS:
  461. * inType
  462. * An enumeration value indicating which option for
  463. * PKIArchiveOptions to use.
  464. * data
  465. * A pointer that will be type-cast and de-referenced according
  466. * to the table under NOTES.
  467. * NOTES:
  468. * A table listing what should be passed in as data
  469. * ------------------------------------------------
  470. *
  471. * inType data
  472. * ------ ----
  473. * crmfEncryptedPrivateKey CRMFEncryptedKey*
  474. * crmfKeyGenParameters SECItem*(This needs to be an octet string)
  475. * crmfArchiveRemGenPrivKey PRBool*
  476. *
  477. * RETURN:
  478. * A pointer the a CRMFPKIArchiveOptions that can be added to a Certificate
  479. * Request. A NULL pointer indicates an error occurred while creating
  480. * the CRMFPKIArchiveOptions Structure.
  481. */
  482. extern CRMFPKIArchiveOptions*
  483. CRMF_CreatePKIArchiveOptions(CRMFPKIArchiveOptionsType inType,
  484. void *data);
  485. /*
  486. * FUNCTION: CRMF_DestroyPKIArchiveOptions
  487. * INPUTS:
  488. * inArchOpt
  489. * A pointer to the CRMFPKIArchiveOptions structure to free.
  490. * NOTES:
  491. * Will free all memory associated with 'inArchOpt'.
  492. * RETURN:
  493. * SECSuccess if successful in freeing the memory used by 'inArchOpt'
  494. * Any other return value indicates an error while freeing the memory.
  495. */
  496. extern SECStatus
  497. CRMF_DestroyPKIArchiveOptions(CRMFPKIArchiveOptions *inArchOpt);
  498. /*
  499. * FUNCTION: CRMF_CertRequestSetPKIArchiveOptions
  500. * INPUTS:
  501. * inCertReq
  502. * The Certificate Request to add the the options to.
  503. * inOptions
  504. * The Archive Options to add to the Certificate Request.
  505. * NOTES:
  506. * Adds the PKIArchiveOption to the Certificate Request. This is what
  507. * enables Key Escrow to take place through CRMF. The library makes
  508. * its own copy of the information.
  509. * RETURN:
  510. * SECSuccess if successful in adding the ArchiveOptions to the Certificate
  511. * request. Any other return value indicates an error when trying to add
  512. * the Archive Options to the Certificate Request.
  513. */
  514. extern SECStatus
  515. CRMF_CertRequestSetPKIArchiveOptions(CRMFCertRequest *inCertReq,
  516. CRMFPKIArchiveOptions *inOptions);
  517. /*
  518. * FUNCTION: CRMF_CertReqMsgGetPOPType
  519. * INPUTS:
  520. * inCertReqMsg
  521. * The Certificate Request Message to operate on.
  522. * NOTES:
  523. * Returns an enumeration value indicating the method of Proof
  524. * of Possession that was used for the passed in Certificate Request
  525. * Message.
  526. * RETURN:
  527. * An enumeration indicating what method for Proof Of Possession is
  528. * being used in this Certificate Request Message. Look in the file
  529. * crmft.h for the definition of CRMFPOPChoice for the possible return
  530. * values.
  531. */
  532. extern CRMFPOPChoice CRMF_CertReqMsgGetPOPType(CRMFCertReqMsg *inCertReqMsg);
  533. /*
  534. * FUNCTION: CRMF_CertReqMsgSetRAVerifiedPOP
  535. * INPUT:
  536. * InCertReqMsg
  537. * The Certificate Request Message to operate on.
  538. * NOTES:
  539. * This function will set the method of Proof Of Possession to
  540. * crmfRAVerified which means the RA has already verified the
  541. * requester does possess the private key.
  542. * RETURN:
  543. * SECSuccess if adding RAVerified to the message is successful.
  544. * Any other message indicates an error while trying to add RAVerified
  545. * as the Proof of Possession.
  546. */
  547. extern SECStatus CRMF_CertReqMsgSetRAVerifiedPOP(CRMFCertReqMsg *inCertReqMsg);
  548. /*
  549. * FUNCTION: CRMF_CertReqMsgSetSignaturePOP
  550. * INPUT:
  551. * inCertReqMsg
  552. * The Certificate Request Message to add the SignaturePOP to.
  553. * inPrivKey
  554. * The Private Key which corresponds to the the Certificate Request
  555. * Message.
  556. * inPubKey
  557. * The Public Key which corresponds to the Private Key passed in.
  558. * inCertForInput
  559. * A Certificate that in the future may be used to create
  560. * POPOSigningKeyInput.
  561. * fn
  562. * A callback for retrieving a password which may be used in the
  563. * future to generate POPOSigningKeyInput.
  564. * arg
  565. * An opaque pointer that would be passed to fn whenever it is
  566. * called.
  567. * NOTES:
  568. * Adds Proof Of Possession to the CertRequest using the signature field
  569. * of the ProofOfPossession field. NOTE: In order to use this option,
  570. * the certificate template must contain the publicKey at the very minimum.
  571. *
  572. * If you don't want the function to generate POPOSigningKeyInput, then
  573. * make sure the cert template already contains the subject and public key
  574. * values. Currently creating POPOSigningKeyInput is not supported, so
  575. * a Message passed to this function must have the publicKey and the subject
  576. * as part of the template
  577. *
  578. * This will take care of creating the entire POPOSigningKey structure
  579. * that will become part of the message.
  580. *
  581. * inPrivKey is the key to be used in the signing operation when creating
  582. * POPOSigningKey structure. This should be the key corresponding to
  583. * the certificate being requested.
  584. *
  585. * inCertForInput will be used if POPOSigningKeyInput needs to be generated.
  586. * It will be used in generating the authInfo.sender field. If the parameter
  587. * is not passed in then authInfo.publicKeyMAC will be generated instead.
  588. * If passed in, this certificate needs to be a valid certificate.
  589. *
  590. * The last 3 arguments are for future compatibility in case we ever want to
  591. * support generating POPOSigningKeyInput. Pass in NULL for all 3 if you
  592. * definitely don't want the funciton to even try to generate
  593. * POPOSigningKeyInput. If you try to use POPOSigningKeyInput, the function
  594. * will fail.
  595. *
  596. * RETURN:
  597. * SECSuccess if adding the Signature Proof Of Possession worked.
  598. * Any other return value indicates an error in trying to add
  599. * the Signature Proof Of Possession.
  600. */
  601. extern SECStatus
  602. CRMF_CertReqMsgSetSignaturePOP(CRMFCertReqMsg *inCertReqMsg,
  603. SECKEYPrivateKey *inPrivKey,
  604. SECKEYPublicKey *inPubKey,
  605. CERTCertificate *inCertForInput,
  606. CRMFMACPasswordCallback fn,
  607. void *arg);
  608. /*
  609. * FUNCTION: CRMF_CertReqMsgSetKeyEnciphermentPOP
  610. * INPUTS:
  611. * inCertReqMsg
  612. * The Certificate Request Message to operate on.
  613. * inKeyChoice
  614. * An enumeration indicating which POPOPrivKey Choice to use
  615. * in constructing the KeyEnciphermentPOP.
  616. * subseqMess
  617. * This parameter must be provided iff inKeyChoice is
  618. * crmfSubsequentMessage. This details how the RA is to respond
  619. * in order to perform Proof Of Possession. Look in crmft.h under
  620. * the definition of CRMFSubseqMessOptions for possible values.
  621. * encPrivKey
  622. * This parameter only needs to be provided if inKeyChoice is
  623. * crmfThisMessage. The item should contain the encrypted private
  624. * key.
  625. *
  626. * NOTES:
  627. * Adds Proof Of Possession using the keyEncipherment field of
  628. * ProofOfPossession.
  629. *
  630. * The funciton looks at the the inKeyChoice parameter and interprets it in
  631. * in the following manner.
  632. *
  633. * If a parameter is not mentioned under interpretation, the funciton will not
  634. * look at its value when implementing that case.
  635. *
  636. * inKeyChoice Interpretation
  637. * ----------- --------------
  638. * crmfThisMessage This options requires that the encrypted private key
  639. * be included in the thisMessage field of POPOPrivKey.
  640. * We don't support this yet, so any clients who want
  641. * to use this feature have to implement a wrapping
  642. * function and agree with the server on how to properly
  643. * wrap the key. That encrypted key must be passed in
  644. * as the encPrivKey parameter.
  645. *
  646. * crmfSubequentMessage Must pass in a value for subseqMess. The value must
  647. * be either CRMFEncrCert or CRMFChallengeResp. The
  648. * parameter encPrivKey will not be looked at in this
  649. * case.
  650. *
  651. * crmfDHMAC This is not a valid option for this function. Passing
  652. * in this value will result in the function returning
  653. * SECFailure.
  654. * RETURN:
  655. * SECSuccess if adding KeyEnciphermentPOP was successful. Any other return
  656. * value indicates an error in adding KeyEnciphermentPOP.
  657. */
  658. extern SECStatus
  659. CRMF_CertReqMsgSetKeyEnciphermentPOP(CRMFCertReqMsg *inCertReqMsg,
  660. CRMFPOPOPrivKeyChoice inKeyChoice,
  661. CRMFSubseqMessOptions subseqMess,
  662. SECItem *encPrivKey);
  663. /*
  664. * FUNCTION: CRMF_CertReqMsgSetKeyAgreementPOP
  665. * INPUTS:
  666. * inCertReqMsg
  667. * The Certificate Request Message to operate on.
  668. * inKeyChoice
  669. * An enumeration indicating which POPOPrivKey Choice to use
  670. * in constructing the KeyAgreementPOP.
  671. * subseqMess
  672. * This parameter must be provided iff inKeyChoice is
  673. * crmfSubsequentMessage. This details how the RA is to respond
  674. * in order to perform Proof Of Possession. Look in crmft.h under
  675. * the definition of CRMFSubseqMessOptions for possible values.
  676. * encPrivKey
  677. * This parameter only needs to be provided if inKeyChoice is
  678. * crmfThisMessage. The item should contain the encrypted private
  679. * key.
  680. * Adds Proof Of Possession using the keyAgreement field of
  681. * ProofOfPossession.
  682. *
  683. * The funciton looks at the the inKeyChoice parameter and interprets it in
  684. * in the following manner.
  685. *
  686. * If a parameter is not mentioned under interpretation, the funciton will not
  687. * look at its value when implementing that case.
  688. *
  689. * inKeyChoice Interpretation
  690. * ----------- --------------
  691. * crmfThisMessage This options requires that the encrypted private key
  692. * be included in the thisMessage field of POPOPrivKey.
  693. * We don't support this yet, so any clients who want
  694. * to use this feature have to implement a wrapping
  695. * function and agree with the server on how to properly
  696. * wrap the key. That encrypted key must be passed in
  697. * as the encPrivKey parameter.
  698. *
  699. * crmfSubequentMessage Must pass in a value for subseqMess. The value must
  700. * be either crmfEncrCert or crmfChallengeResp. The
  701. * parameter encPrivKey will not be looked at in this
  702. * case.
  703. *
  704. * crmfDHMAC This option is not supported.
  705. */
  706. extern SECStatus
  707. CRMF_CertReqMsgSetKeyAgreementPOP(CRMFCertReqMsg *inCertReqMsg,
  708. CRMFPOPOPrivKeyChoice inKeyChoice,
  709. CRMFSubseqMessOptions subseqMess,
  710. SECItem *encPrivKey);
  711. /*
  712. * FUNCTION: CRMF_CreateCertReqMsgFromDER
  713. * INPUTS:
  714. * buf
  715. * A buffer to the DER-encoded Certificate Request Message.
  716. * len
  717. * The length in bytes of the buffer 'buf'
  718. * NOTES:
  719. * This function passes the buffer to the ASN1 decoder and creates a
  720. * CRMFCertReqMsg structure. Do not try adding any fields to a message
  721. * returned from this function. Specifically adding more Controls or
  722. * Extensions may cause your program to crash.
  723. *
  724. * RETURN:
  725. * A pointer to the Certificate Request Message structure. A NULL return
  726. * value indicates the library was unable to parse the DER.
  727. */
  728. extern CRMFCertReqMsg* CRMF_CreateCertReqMsgFromDER(const char *buf, long len);
  729. /*
  730. * FUNCTION: CRMF_CreateCertReqMessagesFromDER
  731. * INPUTS:
  732. * buf
  733. * A buffer to the DER-encoded Certificate Request Messages.
  734. * len
  735. * The length in bytes of buf
  736. * NOTES:
  737. * This function passes the buffer to the ASN1 decoder and creates a
  738. * CRMFCertReqMessages structure. Do not try adding any fields to a message
  739. * derived from this function. Specifically adding more Controls or
  740. * Extensions may cause your program to crash.
  741. * The user must call CRMF_DestroyCertReqMessages after the return value is
  742. * no longer needed, ie when all individual messages have been extracted.
  743. *
  744. * RETURN:
  745. * A pointer to the Certificate Request Messages structure. A NULL return
  746. * value indicates the library was unable to parse the DER.
  747. */
  748. extern CRMFCertReqMessages*
  749. CRMF_CreateCertReqMessagesFromDER(const char *buf, long len);
  750. /*
  751. * FUNCTION: CRMF_DestroyCertReqMessages
  752. * INPUTS
  753. * inCertReqMsgs
  754. * The Messages to destroy.
  755. * RETURN:
  756. * SECSuccess if freeing the memory was done successfully. Any other
  757. * return value indicates an error in freeing up memory.
  758. */
  759. extern SECStatus
  760. CRMF_DestroyCertReqMessages(CRMFCertReqMessages *inCertReqMsgs);
  761. /*
  762. * FUNCTION: CRMF_CertReqMessagesGetNumMessages
  763. * INPUTS:
  764. * inCertReqMsgs
  765. * The Request Messages to operate on.
  766. * RETURN:
  767. * The number of messages contained in the in the Request Messages
  768. * strucure.
  769. */
  770. extern int
  771. CRMF_CertReqMessagesGetNumMessages(CRMFCertReqMessages *inCertReqMsgs);
  772. /*
  773. * FUNCTION: CRMF_CertReqMessagesGetCertReqMsgAtIndex
  774. * INPUTS:
  775. * inReqMsgs
  776. * The Certificate Request Messages to operate on.
  777. * index
  778. * The index of the single message the user wants a copy of.
  779. * NOTES:
  780. * This function returns a copy of the request messages stored at the
  781. * index corresponding to the parameter 'index'. Indexing of the messages
  782. * is done in the same manner as a C array. Meaning the valid index are
  783. * 0...numMessages-1. User must call CRMF_DestroyCertReqMsg when done using
  784. * the return value of this function.
  785. *
  786. * RETURN:
  787. * SECSuccess if copying the message at the requested index was successful.
  788. * Any other return value indicates an invalid index or error while copying
  789. * the single request message.
  790. */
  791. extern CRMFCertReqMsg*
  792. CRMF_CertReqMessagesGetCertReqMsgAtIndex(CRMFCertReqMessages *inReqMsgs,
  793. int index);
  794. /*
  795. * FUNCTION: CRMF_CertReqMsgGetID
  796. * INPUTS:
  797. * inCertReqMsg
  798. * The Certificate Request Message to get the ID from.
  799. * destID
  800. * A pointer to where the library can place the ID of the Message.
  801. * RETURN:
  802. * SECSuccess if the function was able to retrieve the ID and place it
  803. * at *destID. Any other return value indicates an error meaning the value
  804. * in *destId is un-reliable and should not be used by the caller of this
  805. * function.
  806. *
  807. */
  808. extern SECStatus CRMF_CertReqMsgGetID(CRMFCertReqMsg *inCertReqMsg,
  809. long *destID);
  810. /*
  811. * FUNCTION: CRMF_DoesRequestHaveField
  812. * INPUTS:
  813. * inCertReq
  814. * The Certificate Request to operate on.
  815. * inField
  816. * An enumeration indicating which filed of the certificate template
  817. * to look for.
  818. * NOTES:
  819. * All the fields in a certificate template are optional. This function
  820. * checks to see if the requested field is present. Look in crmft.h at the
  821. * definition of CRMFCertTemplateField for possible values for possible
  822. * querying.
  823. *
  824. * RETURN:
  825. * PR_TRUE iff the field corresponding to 'inField' has been specified as part
  826. * of 'inCertReq'
  827. * PR_FALSE iff the field corresponding to 'inField' has not been speicified
  828. * as part of 'inCertReq'
  829. *
  830. */
  831. extern PRBool CRMF_DoesRequestHaveField(CRMFCertRequest *inCertReq,
  832. CRMFCertTemplateField inField);
  833. /*
  834. * FUNCTION: CRMF_CertReqMsgGetCertRequest
  835. * INPUTS:
  836. * inCertReqMsg
  837. * The Certificate Request Message to operate on.
  838. * NOTES:
  839. * This function returns a copy of the Certificate Request to the user.
  840. * The user can keep adding to this request and then making it a part
  841. * of another message. After the user no longer wants to use the
  842. * returned request, the user must call CRMF_DestroyCertRequest and
  843. * pass it the request returned by this function.
  844. * RETURN:
  845. * A pointer to a copy of the certificate request contained by the message.
  846. * A NULL return value indicates an error occurred while copying the
  847. * certificate request.
  848. */
  849. extern CRMFCertRequest *
  850. CRMF_CertReqMsgGetCertRequest(CRMFCertReqMsg *inCertReqMsg);
  851. /*
  852. * FUNCTION: CRMF_CertRequestGetCertTemplateVersion
  853. * INPUTS:
  854. * inCertReq
  855. * The Certificate Request to operate on.
  856. * version
  857. * A pointer to where the library can store the version contatined
  858. * in the certificate template within the certifcate request.
  859. * RETURN:
  860. * SECSuccess if the Certificate template contains the version field. In
  861. * this case, *version will hold the value of the certificate template
  862. * version.
  863. * SECFailure indicates that version field was not present as part of
  864. * of the certificate template.
  865. */
  866. extern SECStatus
  867. CRMF_CertRequestGetCertTemplateVersion(CRMFCertRequest *inCertReq,
  868. long *version);
  869. /*
  870. * FUNCTION: CRMF_CertRequestGetCertTemplateSerialNumber
  871. * INPUTS:
  872. * inCertReq
  873. * The certificate request to operate on.
  874. * serialNumber
  875. * A pointer where the library can put the serial number contained
  876. * in the certificate request's certificate template.
  877. * RETURN:
  878. * If a serial number exists in the CertTemplate of the request, the function
  879. * returns SECSuccess and the value at *serialNumber contains the serial
  880. * number.
  881. * If no serial number is present, then the function returns SECFailure and
  882. * the value at *serialNumber is un-changed.
  883. */
  884. extern SECStatus
  885. CRMF_CertRequestGetCertTemplateSerialNumber(CRMFCertRequest *inCertReq,
  886. long *serialNumber);
  887. /*
  888. * FUNCTION: CRMF_CertRequestGetCertTemplateSigningAlg
  889. * INPUT:
  890. * inCertReq
  891. * The Certificate Request to operate on.
  892. * destAlg
  893. * A Pointer to where the library can place a copy of the signing alg
  894. * used in the cert request's cert template.
  895. * RETURN:
  896. * If the signingAlg is present in the CertRequest's CertTemplate, then
  897. * the function returns SECSuccess and places a copy of sigingAlg in
  898. * *destAlg.
  899. * If no signingAlg is present, then the function returns SECFailure and
  900. * the value at *destAlg is un-changed
  901. */
  902. extern SECStatus
  903. CRMF_CertRequestGetCertTemplateSigningAlg(CRMFCertRequest *inCertReq,
  904. SECAlgorithmID *destAlg);
  905. /*
  906. * FUNCTION: CRMF_CertRequestGetCertTemplateIssuer
  907. * INPUTS:
  908. * inCertReq
  909. * The Certificate Request to operate on.
  910. * destIssuer
  911. * A pointer to where the library can place a copy of the cert
  912. * request's cert template issuer field.
  913. * RETURN:
  914. * If the issuer is present in the cert request cert template, the function
  915. * returns SECSuccess and places a copy of the issuer in *destIssuer.
  916. * If there is no issuer present, the funciton returns SECFailure and the
  917. * value at *destIssuer is unchanged.
  918. */
  919. extern SECStatus
  920. CRMF_CertRequestGetCertTemplateIssuer(CRMFCertRequest *inCertReq,
  921. CERTName *destIssuer);
  922. /*
  923. * FUNCTION: CRMF_CertRequestGetCertTemplateValidity
  924. * INPUTS:
  925. * inCertReq
  926. * The Certificate Request to operate on.
  927. * destValdity
  928. * A pointer to where the library can place a copy of the validity
  929. * info in the cert request cert template.
  930. * NOTES:
  931. * Pass the pointer to
  932. * RETURN:
  933. * If there is an OptionalValidity field, the function will return SECSuccess
  934. * and place the appropriate values in *destValidity->notBefore and
  935. * *destValidity->notAfter. (Each field is optional, but at least one will
  936. * be present if the function returns SECSuccess)
  937. *
  938. * If there is no OptionalValidity field, the function will return SECFailure
  939. * and the values at *destValidity will be un-changed.
  940. */
  941. extern SECStatus
  942. CRMF_CertRequestGetCertTemplateValidity(CRMFCertRequest *inCertReq,
  943. CRMFGetValidity *destValidity);
  944. /*
  945. * FUNCTION: CRMF_DestroyGetValidity
  946. * INPUTS:
  947. * inValidity
  948. * A pointer to the memroy to be freed.
  949. * NOTES:
  950. * The function will free the memory allocated by the function
  951. * CRMF_CertRequestGetCertTemplateValidity. That means only memory pointed
  952. * to within the CRMFGetValidity structure. Since
  953. * CRMF_CertRequestGetCertTemplateValidity does not allocate memory for the
  954. * structure passed into it, it will not free it. Meaning this function will
  955. * free the memory at inValidity->notBefore and inValidity->notAfter, but not
  956. * the memory directly at inValdity.
  957. *
  958. * RETURN:
  959. * SECSuccess if freeing the memory was successful. Any other return value
  960. * indicates an error while freeing the memory.
  961. */
  962. extern SECStatus
  963. CRMF_DestroyGetValidity(CRMFGetValidity *inValidity);
  964. /*
  965. * FUNCTION: CRMF_CertRequestGetCertTemplateSubject
  966. * INPUTS:
  967. * inCertReq
  968. * The Certificate Request to operate on.
  969. * destSubject
  970. * A pointer to where the library can place a copy of the subject
  971. * contained in the request's cert template.
  972. * RETURN:
  973. * If there is a subject in the CertTemplate, then the function returns
  974. * SECSuccess and a copy of the subject is placed in *destSubject.
  975. *
  976. * If there is no subject, the function returns SECFailure and the values at
  977. * *destSubject is unchanged.
  978. */
  979. extern SECStatus
  980. CRMF_CertRequestGetCertTemplateSubject (CRMFCertRequest *inCertReq,
  981. CERTName *destSubject);
  982. /*
  983. * FUNCTION: CRMF_CertRequestGetCertTemplatePublicKey
  984. * INPUTS:
  985. * inCertReq
  986. * The Cert request to operate on.
  987. * destPublicKey
  988. * A pointer to where the library can place a copy of the request's
  989. * cert template public key.
  990. * RETURN:
  991. * If there is a publicKey parameter in the CertRequest, the function returns
  992. * SECSuccess, and places a copy of the publicKey in *destPublicKey.
  993. *
  994. * If there is no publicKey, the function returns SECFailure and the value
  995. * at *destPublicKey is un-changed.
  996. */
  997. extern SECStatus
  998. CRMF_CertRequestGetCertTemplatePublicKey(CRMFCertRequest *inCertReq,
  999. CERTSubjectPublicKeyInfo *destPublicKey);
  1000. /*
  1001. * FUNCTION: CRMF_CertRequestGetCertTemplateIssuerUID
  1002. * INPUTS:
  1003. * inCertReq
  1004. * The Cert request to operate on.
  1005. * destIssuerUID
  1006. * A pointer to where the library can store a copy of the request's
  1007. * cert template destIssuerUID.
  1008. *
  1009. * NOTES:
  1010. * destIssuerUID is a bit string and will be returned in a SECItem as
  1011. * a bit string. Meaning the len field contains the number of valid bits as
  1012. * opposed to the number of bytes allocated.
  1013. *
  1014. * RETURN:
  1015. * If the CertTemplate has an issuerUID, the function returns SECSuccess and
  1016. * places a copy of the issuerUID in *destIssuerUID.
  1017. *
  1018. * If there is no issuerUID, the function returns SECFailure and the value
  1019. * *destIssuerUID is unchanged.
  1020. */
  1021. extern SECStatus
  1022. CRMF_CertRequestGetCertTemplateIssuerUID(CRMFCertRequest *inCertReq,
  1023. SECItem *destIssuerUID);
  1024. /*
  1025. * FUNCTION: CRMF_CertRequestGetCertTemplateSubjectUID
  1026. * inCertReq
  1027. * The Cert request to operate on.
  1028. * destSubjectUID
  1029. * A pointer to where the library can store a copy of the request's
  1030. * cert template destIssuerUID.
  1031. *
  1032. * NOTES:
  1033. * destSubjectUID is a bit string and will be returned in a SECItem as
  1034. * a bit string. Meaning the len field contains the number of valid bits as
  1035. * opposed to the number of bytes allocated.
  1036. *
  1037. * RETURN:
  1038. * If the CertTemplate has an issuerUID, the function returns SECSuccess and
  1039. * places a copy of the issuerUID in *destIssuerUID.
  1040. *
  1041. * If there is no issuerUID, the function returns SECSuccess and the value
  1042. * *destIssuerUID is unchanged.
  1043. */
  1044. extern SECStatus CRMF_GetCertTemplateSubjectUID(CRMFCertRequest *inCertReq,
  1045. SECItem *destSubjectUID);
  1046. /*
  1047. * FUNCTION: CRMF_CertRequestGetNumberOfExtensions
  1048. * INPUTS:
  1049. * inCertReq
  1050. * The cert request to operate on.
  1051. * RETURN:
  1052. * Returns the number of extensions contained by the Cert Request.
  1053. */
  1054. extern int CRMF_CertRequestGetNumberOfExtensions(CRMFCertRequest *inCertReq);
  1055. /*
  1056. * FUNCTION: CRMF_CertRequestGetExtensionAtIndex
  1057. * INPUTS:
  1058. * inCertReq
  1059. * The Certificate request to operate on.
  1060. * index
  1061. * The index of the extension array whihc the user wants to access.
  1062. * NOTES:
  1063. * This function retrieves the extension at the index corresponding to the
  1064. * parameter "index" indicates. Indexing is done like a C array.
  1065. * (0 ... numElements-1)
  1066. *
  1067. * Call CRMF_DestroyCertExtension when done using the return value.
  1068. *
  1069. * RETURN:
  1070. * A pointer to a copy of the extension at the desired index. A NULL
  1071. * return value indicates an invalid index or an error while copying
  1072. * the extension.
  1073. */
  1074. extern CRMFCertExtension *
  1075. CRMF_CertRequestGetExtensionAtIndex(CRMFCertRequest *inCertReq,
  1076. int index);
  1077. /*
  1078. * FUNCTION: CRMF_CertExtensionGetOidTag
  1079. * INPUTS:
  1080. * inExtension
  1081. * The extension to operate on.
  1082. * RETURN:
  1083. * Returns the SECOidTag associated with the cert extension passed in.
  1084. */
  1085. extern SECOidTag CRMF_CertExtensionGetOidTag(CRMFCertExtension *inExtension);
  1086. /*
  1087. * FUNCTION: CRMF_CertExtensionGetIsCritical
  1088. * INPUT:
  1089. * inExt
  1090. * The cert extension to operate on.
  1091. *
  1092. * RETURN:
  1093. * PR_TRUE if the extension is critical.
  1094. * PR_FALSE if the extension is not critical.
  1095. */
  1096. extern PRBool CRMF_CertExtensionGetIsCritical(CRMFCertExtension *inExt);
  1097. /*
  1098. * FUNCTION: CRMF_CertExtensionGetValue
  1099. * INPUT:
  1100. * inExtension
  1101. * The extension to operate on.
  1102. * NOTES:
  1103. * Caller is responsible for freeing the memory associated with the return
  1104. * value. Call SECITEM_FreeItem(retVal, PR_TRUE) when done using the return
  1105. * value.
  1106. *
  1107. * RETURN:
  1108. * A pointer to an item containig the value for the certificate extension.
  1109. * A NULL return value indicates an error in copying the information.
  1110. */
  1111. extern SECItem* CRMF_CertExtensionGetValue(CRMFCertExtension *inExtension);
  1112. /*
  1113. * FUNCTION: CRMF_CertReqMsgGetPOPOSigningKey
  1114. * INPUTS:
  1115. * inCertReqMsg
  1116. * The certificate request message to operate on.
  1117. * destKey
  1118. * A pointer to where the library can place a pointer to
  1119. * a copy of the Proof Of Possession Signing Key used
  1120. * by the message.
  1121. *
  1122. * RETURN:
  1123. * Get the POPOSigningKey associated with this CRMFCertReqMsg.
  1124. * If the CertReqMsg does not have a pop, the function returns
  1125. * SECFailure and the value at *destKey is un-changed..
  1126. *
  1127. * If the CertReqMsg does have a pop, then the CertReqMsg's
  1128. * POPOSigningKey will be placed at *destKey.
  1129. */
  1130. extern SECStatus
  1131. CRMF_CertReqMsgGetPOPOSigningKey(CRMFCertReqMsg *inCertReqMsg,
  1132. CRMFPOPOSigningKey **destKey);
  1133. /*
  1134. * FUNCTION: CRMF_DestroyPOPOSigningKey
  1135. * INPUTS:
  1136. * inKey
  1137. * The signing key to free.
  1138. *
  1139. * RETURN:
  1140. * SECSuccess if freeing the memory was successful. Any other return value
  1141. * indicates an error while freeing memory.
  1142. */
  1143. extern SECStatus CRMF_DestroyPOPOSigningKey (CRMFPOPOSigningKey *inKey);
  1144. /*
  1145. * FUNCTION: CRMF_POPOSigningKeyGetAlgID
  1146. * INPUTS:
  1147. * inSignKey
  1148. * The Signing Key to operate on.
  1149. * RETURN:
  1150. * Return the algorithmID used by the CRMFPOPOSigningKey. User must
  1151. * call SECOID_DestroyAlgorithmID(destID, PR_TRUE) when done using the
  1152. * return value.
  1153. */
  1154. extern SECAlgorithmID*
  1155. CRMF_POPOSigningKeyGetAlgID(CRMFPOPOSigningKey *inSignKey);
  1156. /*
  1157. * FUNCTION: CRMF_POPOSigningKeyGetSignature
  1158. * INPUTS:
  1159. * inSignKey
  1160. * The Signing Key to operate on.
  1161. *
  1162. * RETURN:
  1163. * Get the actual signature stored away in the CRMFPOPOSigningKey. SECItem
  1164. * returned is a BIT STRING, so the len field is the number of bits as opposed
  1165. * to the total number of bytes allocatd. User must call
  1166. * SECITEM_FreeItem(retVal,PR_TRUE) when done using the return value.
  1167. */
  1168. extern SECItem* CRMF_POPOSigningKeyGetSignature(CRMFPOPOSigningKey *inSignKey);
  1169. /*
  1170. * FUNCTION: CRMF_POPOSigningKeyGetInput
  1171. * INPUTS:
  1172. * inSignKey
  1173. * The Signing Key to operate on.
  1174. * NOTES:
  1175. * This function will return the der encoded input that was read in while
  1176. * decoding. The API does not support this option when creating, so you
  1177. * cannot add this field.
  1178. *
  1179. * RETURN:
  1180. * Get the poposkInput that is part of the of the POPOSigningKey. If the
  1181. * optional field is not part of the POPOSigningKey, the function returns
  1182. * NULL.
  1183. *
  1184. * If the optional field is part of the POPOSingingKey, the function will
  1185. * return a copy of the der encoded poposkInput.
  1186. */
  1187. extern SECItem* CRMF_POPOSigningKeyGetInput(CRMFPOPOSigningKey *inSignKey);
  1188. /*
  1189. * FUNCTION: CRMF_CertReqMsgGetPOPKeyEncipherment
  1190. * INPUTS:
  1191. * inCertReqMsg
  1192. * The certificate request message to operate on.
  1193. * destKey
  1194. * A pointer to where the library can place a pointer to a
  1195. * copy of the POPOPrivKey representing Key Encipherment
  1196. * Proof of Possession.
  1197. *NOTES:
  1198. * This function gets the POPOPrivKey associated with this CRMFCertReqMsg
  1199. * for Key Encipherment.
  1200. *
  1201. * RETURN:
  1202. * If the CertReqMsg did not use Key Encipherment for Proof Of Possession, the
  1203. * function returns SECFailure and the value at *destKey is un-changed.
  1204. *
  1205. * If the CertReqMsg did use Key Encipherment for ProofOfPossession, the
  1206. * function returns SECSuccess and places the POPOPrivKey representing the
  1207. * Key Encipherment Proof Of Possessin at *destKey.
  1208. */
  1209. extern SECStatus
  1210. CRMF_CertReqMsgGetPOPKeyEncipherment(CRMFCertReqMsg *inCertReqMsg,
  1211. CRMFPOPOPrivKey **destKey);
  1212. /*
  1213. * FUNCTION: CRMF_CertReqMsgGetPOPKeyAgreement
  1214. * INPUTS:
  1215. * inCertReqMsg
  1216. * The certificate request message to operate on.
  1217. * destKey
  1218. * A pointer to where the library can place a pointer to a
  1219. * copy of the POPOPrivKey representing Key Agreement
  1220. * Proof of Possession.
  1221. * NOTES:
  1222. * This function gets the POPOPrivKey associated with this CRMFCertReqMsg for
  1223. * Key Agreement.
  1224. *
  1225. * RETURN:
  1226. * If the CertReqMsg used Key Agreement for Proof Of Possession, the
  1227. * function returns SECSuccess and the POPOPrivKey for Key Agreement
  1228. * is placed at *destKey.
  1229. *
  1230. * If the CertReqMsg did not use Key Agreement for Proof Of Possession, the
  1231. * function return SECFailure and the value at *destKey is unchanged.
  1232. */
  1233. extern SECStatus
  1234. CRMF_CertReqMsgGetPOPKeyAgreement(CRMFCertReqMsg *inCertReqMsg,
  1235. CRMFPOPOPrivKey **destKey);
  1236. /*
  1237. * FUNCTION: CRMF_DestroyPOPOPrivKey
  1238. * INPUTS:
  1239. * inPrivKey
  1240. * The POPOPrivKey to destroy.
  1241. * NOTES:
  1242. * Destroy a structure allocated by CRMF_GetPOPKeyEncipherment or
  1243. * CRMF_GetPOPKeyAgreement.
  1244. *
  1245. * RETURN:
  1246. * SECSuccess on successful destruction of the POPOPrivKey.
  1247. * Any other return value indicates an error in freeing the
  1248. * memory.
  1249. */
  1250. extern SECStatus CRMF_DestroyPOPOPrivKey(CRMFPOPOPrivKey *inPrivKey);
  1251. /*
  1252. * FUNCTION: CRMF_POPOPrivKeyGetChoice
  1253. * INPUT:
  1254. * inKey
  1255. * The POPOPrivKey to operate on.
  1256. * RETURN:
  1257. * Returns which choice was used in constructing the POPPOPrivKey. Look at
  1258. * the definition of CRMFPOPOPrivKeyChoice in crmft.h for the possible return
  1259. * values.
  1260. */
  1261. extern CRMFPOPOPrivKeyChoice CRMF_POPOPrivKeyGetChoice(CRMFPOPOPrivKey *inKey);
  1262. /*
  1263. * FUNCTION: CRMF_POPOPrivKeyGetThisMessage
  1264. * INPUTS:
  1265. * inKey
  1266. * The POPOPrivKey to operate on.
  1267. * destString
  1268. * A pointer to where the library can place a copy of the This Message
  1269. * field stored in the POPOPrivKey
  1270. *
  1271. * RETURN:
  1272. * Returns the field thisMessage from the POPOPrivKey.
  1273. * If the POPOPrivKey did not use the field thisMessage, the function
  1274. * returns SECFailure and the value at *destString is unchanged.
  1275. *
  1276. * If the POPOPrivKey did use the field thisMessage, the function returns
  1277. * SECSuccess and the BIT STRING representing thisMessage is placed
  1278. * at *destString. BIT STRING representation means the len field is the
  1279. * number of valid bits as opposed to the total number of bytes.
  1280. */
  1281. extern SECStatus CRMF_POPOPrivKeyGetThisMessage(CRMFPOPOPrivKey *inKey,
  1282. SECItem *destString);
  1283. /*
  1284. * FUNCTION: CRMF_POPOPrivKeyGetSubseqMess
  1285. * INPUTS:
  1286. * inKey
  1287. * The POPOPrivKey to operate on.
  1288. * destOpt
  1289. * A pointer to where the library can place the value of the
  1290. * Subsequent Message option used by POPOPrivKey.
  1291. *
  1292. * RETURN:
  1293. * Retrieves the field subsequentMessage from the POPOPrivKey.
  1294. * If the POPOPrivKey used the subsequentMessage option, the function
  1295. * returns SECSuccess and places the appropriate enumerated value at
  1296. * *destMessageOption.
  1297. *
  1298. * If the POPOPrivKey did not use the subsequenMessage option, the function
  1299. * returns SECFailure and the value at *destOpt is un-changed.
  1300. */
  1301. extern SECStatus CRMF_POPOPrivKeyGetSubseqMess(CRMFPOPOPrivKey *inKey,
  1302. CRMFSubseqMessOptions *destOpt);
  1303. /*
  1304. * FUNCTION: CRMF_POPOPrivKeyGetDHMAC
  1305. * INPUTS:
  1306. * inKey
  1307. * The POPOPrivKey to operate on.
  1308. * destMAC
  1309. * A pointer to where the library can place a copy of the dhMAC
  1310. * field of the POPOPrivKey.
  1311. *
  1312. * NOTES:
  1313. * Returns the field dhMAC from the POPOPrivKey. The populated SECItem
  1314. * is in BIT STRING format.
  1315. *
  1316. * RETURN:
  1317. * If the POPOPrivKey used the dhMAC option, the function returns SECSuccess
  1318. * and the BIT STRING for dhMAC will be placed at *destMAC. The len field in
  1319. * destMAC (ie destMAC->len) will be the valid number of bits as opposed to
  1320. * the number of allocated bytes.
  1321. *
  1322. * If the POPOPrivKey did not use the dhMAC option, the function returns
  1323. * SECFailure and the value at *destMAC is unchanged.
  1324. *
  1325. */
  1326. extern SECStatus CRMF_POPOPrivKeyGetDHMAC(CRMFPOPOPrivKey *inKey,
  1327. SECItem *destMAC);
  1328. /*
  1329. * FUNCTION: CRMF_CertRequestGetNumControls
  1330. * INPUTS:
  1331. * inCertReq
  1332. * The Certificate Request to operate on.
  1333. * RETURN:
  1334. * Returns the number of Controls registered with this CertRequest.
  1335. */
  1336. extern int CRMF_CertRequestGetNumControls (CRMFCertRequest *inCertReq);
  1337. /*
  1338. * FUNCTION: CRMF_CertRequestGetControlAtIndex
  1339. * INPUTS:
  1340. * inCertReq
  1341. * The certificate request to operate on.
  1342. * index
  1343. * The index of the control the user wants a copy of.
  1344. * NOTES:
  1345. * Function retrieves the Control at located at index. The Controls
  1346. * are numbered like a traditional C array (0 ... numElements-1)
  1347. *
  1348. * RETURN:
  1349. * Returns a copy of the control at the index specified. This is a copy
  1350. * so the user must call CRMF_DestroyControl after the return value is no
  1351. * longer needed. A return value of NULL indicates an error while copying
  1352. * the control or that the index was invalid.
  1353. */
  1354. extern CRMFControl*
  1355. CRMF_CertRequestGetControlAtIndex(CRMFCertRequest *inCertReq,
  1356. int index);
  1357. /*
  1358. * FUNCTION: CRMF_DestroyControl
  1359. * INPUTS:
  1360. * inControl
  1361. * The Control to destroy.
  1362. * NOTES:
  1363. * Destroy a CRMFControl allocated by CRMF_GetControlAtIndex.
  1364. *
  1365. * RETURN:
  1366. * SECSuccess if freeing the memory was successful. Any other return
  1367. * value indicates an error while freeing the memory.
  1368. */
  1369. extern SECStatus CRMF_DestroyControl(CRMFControl *inControl);
  1370. /*
  1371. * FUNCTION: CRMF_ControlGetControlType
  1372. * INPUTS:
  1373. * inControl
  1374. * The control to operate on.
  1375. * NOTES:
  1376. * The function returns an enumertion which indicates the type of control
  1377. * 'inControl'.
  1378. *
  1379. * RETURN:
  1380. * Look in crmft.h at the definition of the enumerated type CRMFControlType
  1381. * for the possible return values.
  1382. */
  1383. extern CRMFControlType CRMF_ControlGetControlType(CRMFControl *inControl);
  1384. /*
  1385. * FUNCTION: CRMF_ControlGetRegTokenControlValue
  1386. * INPUTS:
  1387. * inControl
  1388. * The Control to operate on.
  1389. * NOTES:
  1390. * The user must call SECITEM_FreeItem passing in the return value
  1391. * after the returnvalue is no longer needed.
  1392. * RETURN:
  1393. * Return the value for a Registration Token Control.
  1394. * The SECItem returned should be in UTF8 format. A NULL
  1395. * return value indicates there was no Registration Control associated
  1396. * with the Control.
  1397. * (This library will not verify format. It assumes the client properly
  1398. * formatted the strings when adding it or the message decoded was properly
  1399. * formatted. The library will just give back the bytes it was given.)
  1400. */
  1401. extern SECItem* CRMF_ControlGetRegTokenControlValue(CRMFControl *inControl);
  1402. /*
  1403. * FUNCTION: CRMF_ControlGetAuthenticatorControlValue
  1404. * INPUTS:
  1405. * inControl
  1406. * The Control to operate on.
  1407. * NOTES:
  1408. * The user must call SECITEM_FreeItem passing in the return value
  1409. * after the returnvalue is no longer needed.
  1410. *
  1411. * RETURN:
  1412. * Return the value for the Authenticator Control.
  1413. * The SECItem returned should be in UTF8 format. A NULL
  1414. * return value indicates there was no Authenticator Control associated
  1415. * with the CRMFControl..
  1416. * (This library will not verify format. It assumes the client properly
  1417. * formatted the strings when adding it or the message decoded was properly
  1418. * formatted. The library will just give back the bytes it was given.)
  1419. */
  1420. extern SECItem* CRMF_ControlGetAuthicatorControlValue(CRMFControl *inControl);
  1421. /*
  1422. * FUNCTION: CRMF_ControlGetPKIArchiveOptions
  1423. * INPUTS:inControl
  1424. * The Control tooperate on.
  1425. * NOTES:
  1426. * This function returns a copy of the PKIArchiveOptions. The user must call
  1427. * the function CRMF_DestroyPKIArchiveOptions when the return value is no
  1428. * longer needed.
  1429. *
  1430. * RETURN:
  1431. * Get the PKIArchiveOptions associated with the Control. A return
  1432. * value of NULL indicates the Control was not a PKIArchiveOptions
  1433. * Control.
  1434. */
  1435. extern CRMFPKIArchiveOptions*
  1436. CRMF_ControlGetPKIArchiveOptions(CRMFControl *inControl);
  1437. /*
  1438. * FUNCTION: CMRF_DestroyPKIArchiveOptions
  1439. * INPUTS:
  1440. * inOptions
  1441. * The ArchiveOptions to destroy.
  1442. * NOTE:
  1443. * Destroy the CRMFPKIArchiveOptions structure.
  1444. *
  1445. * RETURN:
  1446. * SECSuccess if successful in freeing all the memory associated with
  1447. * the PKIArchiveOptions. Any other return value indicates an error while
  1448. * freeing the PKIArchiveOptions.
  1449. */
  1450. extern SECStatus
  1451. CRMF_DestroyPKIArchiveOptions(CRMFPKIArchiveOptions *inOptions);
  1452. /*
  1453. * FUNCTION: CRMF_PKIArchiveOptionsGetOptionType
  1454. * INPUTS:
  1455. * inOptions
  1456. * The PKIArchiveOptions to operate on.
  1457. * RETURN:
  1458. * Returns the choice used for the PKIArchiveOptions. Look at the definition
  1459. * of CRMFPKIArchiveOptionsType in crmft.h for possible return values.
  1460. */
  1461. extern CRMFPKIArchiveOptionsType
  1462. CRMF_PKIArchiveOptionsGetOptionType(CRMFPKIArchiveOptions *inOptions);
  1463. /*
  1464. * FUNCTION: CRMF_PKIArchiveOptionsGetEncryptedPrivKey
  1465. * INPUTS:
  1466. * inOpts
  1467. * The PKIArchiveOptions to operate on.
  1468. *
  1469. * NOTES:
  1470. * The user must call CRMF_DestroyEncryptedKey when done using this return
  1471. * value.
  1472. *
  1473. * RETURN:
  1474. * Get the encryptedPrivKey field of the PKIArchiveOptions structure.
  1475. * A return value of NULL indicates that encryptedPrivKey was not used as
  1476. * the choice for this PKIArchiveOptions.
  1477. */
  1478. extern CRMFEncryptedKey*
  1479. CRMF_PKIArchiveOptionsGetEncryptedPrivKey(CRMFPKIArchiveOptions *inOpts);
  1480. /*
  1481. * FUNCTION: CRMF_EncryptedKeyGetChoice
  1482. * INPUTS:
  1483. * inEncrKey
  1484. * The EncryptedKey to operate on.
  1485. *
  1486. * NOTES:
  1487. * Get the choice used for representing the EncryptedKey.
  1488. *
  1489. * RETURN:
  1490. * Returns the Choice used in representing the EncryptedKey. Look in
  1491. * crmft.h at the definition of CRMFEncryptedKeyChoice for possible return
  1492. * values.
  1493. */
  1494. extern CRMFEncryptedKeyChoice
  1495. CRMF_EncryptedKeyGetChoice(CRMFEncryptedKey *inEncrKey);
  1496. /*
  1497. * FUNCTION: CRMF_EncryptedKeyGetEncryptedValue
  1498. * INPUTS:
  1499. * inKey
  1500. * The EncryptedKey to operate on.
  1501. *
  1502. * NOTES:
  1503. * The user must call CRMF_DestroyEncryptedValue passing in
  1504. * CRMF_GetEncryptedValue's return value.
  1505. *
  1506. * RETURN:
  1507. * A pointer to a copy of the EncryptedValue contained as a member of
  1508. * the EncryptedKey.
  1509. */
  1510. extern CRMFEncryptedValue*
  1511. CRMF_EncryptedKeyGetEncryptedValue(CRMFEncryptedKey *inKey);
  1512. /*
  1513. * FUNCTION: CRMF_DestroyEncryptedValue
  1514. * INPUTS:
  1515. * inEncrValue
  1516. * The EncryptedValue to destroy.
  1517. *
  1518. * NOTES:
  1519. * Free up all memory associated with 'inEncrValue'.
  1520. *
  1521. * RETURN:
  1522. * SECSuccess if freeing up the memory associated with the EncryptedValue
  1523. * is successful. Any other return value indicates an error while freeing the
  1524. * memory.
  1525. */
  1526. extern SECStatus CRMF_DestroyEncryptedValue(CRMFEncryptedValue *inEncrValue);
  1527. /*
  1528. * FUNCTION: CRMF_EncryptedValueGetEncValue
  1529. * INPUTS:
  1530. * inEncValue
  1531. * The EncryptedValue to operate on.
  1532. * NOTES:
  1533. * Function retrieves the encValue from an EncryptedValue structure.
  1534. *
  1535. * RETURN:
  1536. * A poiner to a SECItem containing the encValue of the EncryptedValue
  1537. * structure. The return value is in BIT STRING format, meaning the
  1538. * len field of the return structure represents the number of valid bits
  1539. * as opposed to the allocated number of bytes.
  1540. * ANULL return value indicates an error in copying the encValue field.
  1541. */
  1542. extern SECItem* CRMF_EncryptedValueGetEncValue(CRMFEncryptedValue *inEncValue);
  1543. /*
  1544. * FUNCTION: CRMF_EncryptedValueGetIntendedAlg
  1545. * INPUTS
  1546. * inEncValue
  1547. * The EncryptedValue to operate on.
  1548. * NOTES:
  1549. * Retrieve the IntendedAlg field from the EncryptedValue structure.
  1550. * Call SECOID_DestroyAlgorithmID (destAlgID, PR_TRUE) after done using
  1551. * the return value. When present, this alogorithm is the alogrithm for
  1552. * which the private key will be used.
  1553. *
  1554. * RETURN:
  1555. * A Copy of the intendedAlg field. A NULL return value indicates the
  1556. * optional field was not present in the structure.
  1557. */
  1558. extern SECAlgorithmID*
  1559. CRMF_EncryptedValueGetIntendedAlg(CRMFEncryptedValue *inEncValue);
  1560. /*
  1561. * FUNCTION: CRMF_EncryptedValueGetSymmAlg
  1562. * INPUTS
  1563. * inEncValue
  1564. * The EncryptedValue to operate on.
  1565. * NOTES:
  1566. * Retrieve the symmAlg field from the EncryptedValue structure.
  1567. * Call SECOID_DestroyAlgorithmID (destAlgID, PR_TRUE) after done using
  1568. * the return value. When present, this is algorithm used to
  1569. * encrypt the encValue of the EncryptedValue.
  1570. *
  1571. * RETURN:
  1572. * A Copy of the symmAlg field. A NULL return value indicates the
  1573. * optional field was not present in the structure.
  1574. */
  1575. extern SECAlgorithmID*
  1576. CRMF_EncryptedValueGetSymmAlg(CRMFEncryptedValue *inEncValue);
  1577. /*
  1578. * FUNCTION: CRMF_EncryptedValueGetKeyAlg
  1579. * INPUTS
  1580. * inEncValue
  1581. * The EncryptedValue to operate on.
  1582. * NOTES:
  1583. * Retrieve the keyAlg field from the EncryptedValue structure.
  1584. * Call SECOID_DestroyAlgorithmID (destAlgID, PR_TRUE) after done using
  1585. * the return value. When present, this is the algorithm used to encrypt
  1586. * the symmetric key in the encSymmKey field of the EncryptedValue structure.
  1587. *
  1588. * RETURN:
  1589. * A Copy of the keyAlg field. A NULL return value indicates the
  1590. * optional field was not present in the structure.
  1591. */
  1592. extern SECAlgorithmID*
  1593. CRMF_EncryptedValueGetKeyAlg(CRMFEncryptedValue *inEncValue);
  1594. /*
  1595. * FUNCTION: CRMF_EncryptedValueGetValueHint
  1596. * INPUTS:
  1597. * inEncValue
  1598. * The EncryptedValue to operate on.
  1599. *
  1600. * NOTES:
  1601. * Return a copy of the der-encoded value hint.
  1602. * User must call SECITEM_FreeItem(retVal, PR_TRUE) when done using the
  1603. * return value. When, present, this is a value that the client which
  1604. * originally issued a certificate request can use to reproduce any data
  1605. * it wants. The RA does not know how to interpret this data.
  1606. *
  1607. * RETURN:
  1608. * A copy of the valueHint field of the EncryptedValue. A NULL return
  1609. * value indicates the optional valueHint field is not present in the
  1610. * EncryptedValue.
  1611. */
  1612. extern SECItem*
  1613. CRMF_EncryptedValueGetValueHint(CRMFEncryptedValue *inEncValue);
  1614. /*
  1615. * FUNCTION: CRMF_EncrypteValueGetEncSymmKey
  1616. * INPUTS:
  1617. * inEncValue
  1618. * The EncryptedValue to operate on.
  1619. *
  1620. * NOTES:
  1621. * Return a copy of the encSymmKey field. This field is the encrypted
  1622. * symmetric key that the client uses in doing Public Key wrap of a private
  1623. * key. When present, this is the symmetric key that was used to wrap the
  1624. * private key. (The encrypted private key will be stored in encValue
  1625. * of the same EncryptedValue structure.) The user must call
  1626. * SECITEM_FreeItem(retVal, PR_TRUE) when the return value is no longer
  1627. * needed.
  1628. *
  1629. * RETURN:
  1630. * A copy of the optional encSymmKey field of the EncryptedValue structure.
  1631. * The return value will be in BIT STRING format, meaning the len field will
  1632. * be the number of valid bits as opposed to the number of bytes. A return
  1633. * value of NULL means the optional encSymmKey field was not present in
  1634. * the EncryptedValue structure.
  1635. */
  1636. extern SECItem*
  1637. CRMF_EncryptedValueGetEncSymmKey(CRMFEncryptedValue *inEncValue);
  1638. /*
  1639. * FUNCTION: CRMF_PKIArchiveOptionsGetKeyGenParameters
  1640. * INPUTS:
  1641. * inOptions
  1642. * The PKiArchiveOptions to operate on.
  1643. *
  1644. * NOTES:
  1645. * User must call SECITEM_FreeItem(retVal, PR_TRUE) after the return
  1646. * value is no longer needed.
  1647. *
  1648. * RETURN:
  1649. * Get the keyGenParameters field of the PKIArchiveOptions.
  1650. * A NULL return value indicates that keyGenParameters was not
  1651. * used as the choice for this PKIArchiveOptions.
  1652. *
  1653. * The SECItem returned is in BIT STRING format (ie, the len field indicates
  1654. * number of valid bits as opposed to allocated number of bytes.)
  1655. */
  1656. extern SECItem*
  1657. CRMF_PKIArchiveOptionsGetKeyGenParameters(CRMFPKIArchiveOptions *inOptions);
  1658. /*
  1659. * FUNCTION: CRMF_PKIArchiveOptionsGetArchiveRemGenPrivKey
  1660. * INPUTS:
  1661. * inOpt
  1662. * The PKIArchiveOptions to operate on.
  1663. * destVal
  1664. * A pointer to where the library can place the value for
  1665. * arciveRemGenPrivKey
  1666. * RETURN:
  1667. * If the PKIArchiveOptions used the archiveRemGenPrivKey field, the
  1668. * function returns SECSuccess and fills the value at *destValue with either
  1669. * PR_TRUE or PR_FALSE, depending on what the PKIArchiveOptions has as a
  1670. * value.
  1671. *
  1672. * If the PKIArchiveOptions does not use the archiveRemGenPrivKey field, the
  1673. * function returns SECFailure and the value at *destValue is unchanged.
  1674. */
  1675. extern SECStatus
  1676. CRMF_PKIArchiveOptionsGetArchiveRemGenPrivKey(CRMFPKIArchiveOptions *inOpt,
  1677. PRBool *destVal);
  1678. /* Helper functions that can be used by other libraries. */
  1679. /*
  1680. * A quick helper funciton to get the best wrap mechanism.
  1681. */
  1682. extern CK_MECHANISM_TYPE CRMF_GetBestWrapPadMechanism(PK11SlotInfo *slot);
  1683. /*
  1684. * A helper function to get a randomly generated IV from a mechanism
  1685. * type.
  1686. */
  1687. extern SECItem* CRMF_GetIVFromMechanism(CK_MECHANISM_TYPE mechType);
  1688. SEC_END_PROTOS
  1689. #endif /*_CRMF_H_*/