📄 crmfres.h
字号:
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- *//* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is the Netscape security libraries. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1994-2000 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. *//* * FILE: crmfres.h * --------------- * This file defines the public interface for the class SSMCRMFRequest * which is to be used in PSM to implement all necessary CRMF * functionality. */#ifndef _CRMFRES_H_#define _CRMFRES_H_#include "cmmf.h"#include "keyres.h"#include "ssmdefs.h"#include "ctrlconn.h"/* * STRUCTURE: SSMCRMFRequest * ------------------------- * This is the structure used to implement the SSMCRMFRequest * class. This class will be used to create CRMF Requests within * PSM. SSMCRMFRequest sub-classess off of SSMResource so it * must always follow any guidelines for naming and defining presented * by the SSMResource class. * * The fields: * * super The mandatory first member for any class sub-classing * from SSMResource. * * m_KeyGenType An enumerated type indicating what type of key pair * we are creating a request for. This value is used * to set the appropriate keyUsage extensions and also * determining the proper method to set for * Proof-Of-Possession. Look at the file * ns/security/ssm/lib/protocol/ssmdefs.h for valid values. * This value is set by the client. * * m_KeyPair A pointer to a key pair associated with the instantiation * of the CRMF request. The members mPrivKey and mPubKey * must be non-NULL values when a new request is created. * * m_CRMFRequest This is the member that holds all of the state information * about the CRMF request. * * m_Connection This is the control connection associated with the * request. */typedef struct SSMCRMFRequest { SSMResource super; /* This must always be the first member of the * structure. Do not add another * field before it or remove it. */ SSMKeyGenType m_KeyGenType; SSMKeyPair *m_KeyPair; CRMFCertRequest *m_CRMFRequest; SSMControlConnection *m_Connection;} SSMCRMFRequest;/* * STRUCTURE: SSMCRMFRequestArg * ---------------------------- * This structure will be used to pass the initialization information * to the SSMCRMFRequest_Init function. * * keyPair The key pair that will be associated with the * new CRMF request. * * connection The control connection to be associated with the * new CRMF request. The SSMCRMFRequest object will * use to get to the certificate and key databases. */typedef struct SSMCRMFRequestArgStr { SSMKeyPair *keyPair; SSMControlConnection *connection;} SSMCRMFRequestArg;/* * FUNCTION:SSM_CreateNewCRMFRequest * --------------------------------- * INPUTS: * msg * The message from the client requesting a new CRMF request. * connection * The control connection to be associated with the new request. * destID * Pointer to a pre-allocated chunk of memory where the function * will place the ID of the newly created SSMCRMFRequest Object. * * NOTES: * This function takes the message received by the client, interprets * the message, creates a new SSMCRMFObject, adds it to the Global Resource * table, and places the resource id of the new object at *destID. To free * the returned object, call SSM_FreeResource and pass in the object object * ID placed at *destID by this function. * * RETURN: * The function returns PR_SUCCESS when successful. Any other return value * should be interpreted as an error. */SSMStatus SSM_CreateNewCRMFRequest(SECItem *msg, SSMControlConnection *connection, SSMResourceID *destID);/* * FUNCTION: SSMCRMFRequest_Create * ------------------------------- * INPUTS: * arg * The creation argument for the SSMCRMFRequest class. This should * be a pointer to SSMKeyPair resource. * res * Pointer to a pre-allocated chunk of memory where the function can * place the value of the pointer to the newly created SSMCRMFRequest * object * * NOTES: * This function serves as the constructor for the SSMCRMFRequest class. This * function overrides the function SSMResource_Create which is the super * class for SSMCRMFRequest. * * RETURN: * Returns PR_SUCCESS upon successful creation. Any other error indicates an * error. */SSMStatus SSMCRMFRequest_Create(void *arg, SSMControlConnection * conn, SSMResource **res);/* * FUNCTION: SSMCRMFRequest_Init * ----------------------------- * INPUTS: * inCRMFReq * A pointer to a newly allocated SSMCRMFRequest which needs to be * initialized. * type * The type for the class that is being initialized. This value should * always be SSM_RESTYPE_CRMFREQ. (Unless one day someone decides to * sub-class off of SSMCRMFRequest.) * inKeyPair * The Key Pair to associate with the CRMF request being initialized. * inConnection * The control connection to be associated with the request being * initialized. * * NOTES: * This function intializes a new SSMCRMFRequest object. This function will * initialize its super-class member and make sure the passed in key pair has * non-NULL values for mPrivKey and mPubKey before getting a reference to the * passed in key pair. Finally, the function creates a * new NSS based CRMF request and sets the following fields in the request: * 1) version is set v3 Cert * 2) The Public Key value in the request * * RETURN: * The function returns PR_SUCCESS upon successful initialization. Any other * return value should be interpreted as an error. */SSMStatus SSMCRMFRequest_Init(SSMCRMFRequest *inCRMFReq, SSMControlConnection * conn, SSMResourceType type, SSMKeyPair *inKeyPair, SSMControlConnection *inConnection);/* * FUNCTION: SSMCRMFRequest_Destroy * -------------------------------- * INPUTS: * inRequest * A pointer to a SSMResource of type SSM_RESTYPE_CRMFREQ to be
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -