RSA Security logo

RSA BSAFE Cert-C
API Reference

crmf.h

Go to the documentation of this file.
00001 /*  
00002 ** Copyright (c) 2000-2002, RSA Security Inc.
00003 **
00004 ** This file is used to demonstrate how to interface to an RSA
00005 ** Security licensed development product.  You have a
00006 ** royalty-free right to use, modify, reproduce and distribute this
00007 ** demonstration file (including any modified version), provided that
00008 ** you agree that RSA Security has no warranty, implied or
00009 ** otherwise, or liability for this demonstration file or any modified
00010 ** version.
00011 **
00012 */
00013 
00020 #ifndef CRMF_H
00021 #define CRMF_H
00022 
00023 #include "certc.h"
00024 
00025 #ifdef __cplusplus
00026 extern "C"
00027 {
00028 #endif
00029 
00030 
00031 /* Useful regInfo and regControl OID values (e.g. as 
00032    used in CRMF, a part of CMP).  These values are
00033    used as attribute types in Cert-C ATTRIBUTES_OBJs:
00034   
00035    regControl types:
00036 */
00037 extern unsigned char ID_REGCTRL_REGTOKEN[];
00038 extern unsigned char ID_REGCTRL_AUTHENTICATOR[];
00039 extern unsigned char ID_REGCTRL_PKIPUBLICATIONINFO[];
00040 extern unsigned char ID_REGCTRL_PKIARCHIVEOPTIONS[];
00041 extern unsigned char ID_REGCTRL_OLDCERTID[];
00042 extern unsigned char ID_REGCTRL_PROTOCOLENCRKEY[];
00043 #define ID_REGCTRL_REGTOKEN_LEN            9
00044 #define ID_REGCTRL_AUTHENTICATOR_LEN       9
00045 #define ID_REGCTRL_PKIPUBLICATIONINFO_LEN  9
00046 #define ID_REGCTRL_PKIARCHIVEOPTIONS_LEN   9
00047 #define ID_REGCTRL_OLDCERTID_LEN           9
00048 #define ID_REGCTRL_PROTOCOLENCRKEY_LEN     9
00049 
00050 /* regInfo types */
00051 extern unsigned char ID_REGINFO_UTF8PAIRS[];
00052 extern unsigned char ID_REGINFO_CERTREQ[];
00053 #define ID_REGINFO_UTF8PAIRS_LEN           9
00054 #define ID_REGINFO_CERTREQ_LEN             9
00055 
00056 
00057 
00058 /* Publication registration control values 
00059  * and structures 
00060  */
00061 #define DONT_PUBLISH        0
00062 #define PLEASE_PUBLISH      1
00063 
00064 #define METHOD_DONTCARE     0
00065 #define METHOD_X500         1
00066 #define METHOD_WEB          2
00067 #define METHOD_LDAP         3
00068 
00069 typedef struct SINGLE_PUB_INFO {
00070     int             method;
00071     GENERAL_NAME   *pPubLocation;
00072 } SINGLE_PUB_INFO;
00073 
00074 
00075 /* Archival registration control values and structures */
00076 #define ENCRYPTED_VALUE     1
00077 #define ENVELOPED_DATA      0
00078 
00079 #define ARCHIVE_ENCRYPTED_KEY       0
00080 #define ARCHIVE_KEYGENPARAMS        1
00081 #define ARCHIVE_REMGENPRIVKEY       2
00082 
00083 typedef struct ENCRYPTED_KEY_INFO {
00084     int                 keyWrapChoice;
00085     PKI_RECIPIENT_INFO  *pRecipient;
00086     B_KEY_OBJ           privateKey;
00087     ITEM                *pEnvelopedData;
00088 } ENCRYPTED_KEY_INFO;
00089 
00090 typedef struct PKI_ARCHIVE_OPTION {
00091     int        choice;
00092     union {
00093        ENCRYPTED_KEY_INFO encryptedKey;
00094        ITEM               keyGenParams;
00095        int                archiveRemGenPrivKey;
00096     }          option;
00097 } PKI_ARCHIVE_OPTION;
00098 
00099 
00100 /* "Helper" functions for adding certain registration
00101  * control and/or information to messages
00102  */
00103 
00129 int S_AddPKIPublicationInfo( 
00130     CERTC_CTX       ctx,          /* (in)  Cert-C context                        */
00131     int             action,       /* (in)  Publication action to take.           */
00132                                   /*       One of DONT_PUBLISH or PLEASE_PUBLISH.  */
00133     SINGLE_PUB_INFO *pPubInfos,   /* (in)  Pointer to first element in array     */
00134                                   /*       of SINGLE_PUB_INFOs.  Contains        */
00135                                   /*       information about how and where to    */
00136                                   /*       publish the cert.  Must be NULL if    */
00137                                   /*       action is DONT_PUBLISH.                */
00138     unsigned int    pubInfoCount, /* (in)  Number of elements in array of        */
00139                                   /*       SINGLE_PUB_INFOs.                     */
00140     ATTRIBUTES_OBJ  controls );   /* (mod) control object to add publication     */
00141                                   /*       information to.                       */
00142 
00143 int S_AddPKIArchiveOptions( 
00144     CERTC_CTX ctx,                      /* (in)  Cert-C context                 */
00145     PKI_ARCHIVE_OPTION *pArchiveOption, /* (in)  Private key archive            */
00146                                         /*       information to add to          */
00147                                         /*       the request                    */
00148     ATTRIBUTES_OBJ  controls );         /* (mod) control object to add archival */
00149                                         /*       information to.                */
00150 
00151 int S_AddProtocolEncrKey( 
00152     CERTC_CTX ctx,                /* (in)  Cert-C context                   */
00153     ITEM *pSPKI,                  /* (in)  Public key value which can be    */
00154                                   /*       used to encrypt messages to      */
00155                                   /*       the requestor.                   */                   
00156     ATTRIBUTES_OBJ controls );    /* (mod) control object to add encryption */
00157                                   /*       information to.                  */
00158 
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162 
00163 #endif /* _CRMF_H_ */



RSA BSAFE® Cert-C 2.7 API Reference