p12res.h
上传用户:lyxiangda
上传日期:2007-01-12
资源大小:3042k
文件大小:4k
源码类别:

CA认证

开发平台:

WINDOWS

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3.  * The contents of this file are subject to the Mozilla Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/MPL/
  7.  * 
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  * 
  13.  * The Original Code is the Netscape security libraries.
  14.  * 
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation.  Portions created by Netscape are 
  17.  * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
  18.  * Rights Reserved.
  19.  * 
  20.  * Contributor(s):
  21.  * 
  22.  * Alternatively, the contents of this file may be used under the
  23.  * terms of the GNU General Public License Version 2 or later (the
  24.  * "GPL"), in which case the provisions of the GPL are applicable 
  25.  * instead of those above.  If you wish to allow use of your 
  26.  * version of this file only under the terms of the GPL and not to
  27.  * allow others to use your version of this file under the MPL,
  28.  * indicate your decision by deleting the provisions above and
  29.  * replace them with the notice and other provisions required by
  30.  * the GPL.  If you do not delete the provisions above, a recipient
  31.  * may use your version of this file under either the MPL or the
  32.  * GPL.
  33.  */
  34. #ifndef P12RES_H_
  35. #define P12RES_H_
  36. #include "resource.h"
  37. #include "ctrlconn.h"
  38. /*
  39.  * Initially, this will only be used as a resource to use in doing UI
  40.  * events necessary for PKCS12 operations.
  41.  */
  42. typedef struct SSMPKCS12ContextStr SSMPKCS12Context;
  43. typedef struct SSMPKCS12BackupThreadArgStr {
  44.     CERTCertificate **certs;
  45.     PRIntn            numCerts;
  46. } SSMPKCS12BackupThreadArg;
  47. struct SSMPKCS12ContextStr {
  48.     SSMResource  super;
  49.     char        *m_password;
  50.     PRFileDesc  *m_file;
  51.     PRFileDesc  *m_digestFile;
  52.     char        *m_tempFilePath;
  53.     PRBool       m_error;
  54.     PRBool       m_inputProcessed;
  55.     PRBool       m_isExportContext; /* We're either importing or exporting. */
  56.     CERTCertificate *m_cert;
  57.     PRThread        *m_thread; /* A thread for doing backup when doing
  58.                                 * CMMF.
  59.                                 */
  60.     SSMPKCS12BackupThreadArg *arg;
  61. };
  62. typedef struct SSMPKCS12CreateArgStr {
  63.     PRBool isExportContext;
  64. } SSMPKCS12CreateArg;
  65. SSMStatus
  66. SSMPKCS12Context_Create(void *arg, SSMControlConnection *ctrl,
  67.                         SSMResource **res);
  68. SSMStatus
  69. SSMPKCS12Context_Init(SSMControlConnection *ctrl, SSMPKCS12Context *res,
  70.                       SSMResourceType type, PRBool isExportContext);
  71. SSMStatus
  72. SSMPKCS12Context_Destroy(SSMResource *res, PRBool doFree);
  73. SSMStatus
  74. SSMPKCS12Context_FormSubmitHandler(SSMResource *res, HTTPRequest *req);
  75. SSMStatus
  76. SSMPKCS12Context_Print(SSMResource *res,
  77.                        char        *fmt,
  78.                        PRIntn       numParams,
  79.                        char       **value,
  80.                        char       **resultStr);
  81. SSMStatus
  82. SSMPKCS12Context_CreatePKCS12File(SSMPKCS12Context *cxt, 
  83.                                   PRBool forceAuthenticate);
  84. SSMStatus
  85. SSMPKCS12Context_RestoreCertFromPKCS12File(SSMPKCS12Context *cxt);
  86. SSMStatus
  87. SSMPKCS12Context_ProcessPromptReply(SSMResource *res,
  88.                                     char *reply);
  89. PRBool
  90. SSM_UCS2_ASCIIConversion(PRBool toUnicode, 
  91.                          unsigned char *inBuf, unsigned int inBufLen,
  92.                          unsigned char *outBuf, unsigned int maxOutBufLen,
  93.                          unsigned int *outBufLen, PRBool swapBytes);
  94. PRBool
  95. SSM_UCS2_UTF8Conversion(PRBool toUnicode, unsigned char *inBuf,
  96.                            unsigned int inBufLen,unsigned char *outBuf,
  97.                            unsigned int maxOutBufLen, unsigned int *outBufLen);
  98. SSMStatus
  99. SSMPKCS12Context_CreatePKCS12FileForMultipleCerts(SSMPKCS12Context *p12Cxt, 
  100.                                                   PRBool forceAuthenticate,
  101.                                                   CERTCertificate **certArr,
  102.                                                   PRIntn numCerts);
  103. void SSMPKCS12Context_BackupMultipleCertsThread(void *arg);
  104. #endif /*P12RES_H_*/