RSA BSAFE Micro Edition Suite

Streamlined security for mobile and embedded devices

Search  Print

r_cert_req.h

Go to the documentation of this file.
00001 /* $Id: r_cert_req.h,v 1.60 2005/06/27 01:51:40 jmckee Exp $ */
00002 /*
00003  * Copyright (C) 1998-2003 RSA Security Inc. All rights reserved.
00004  *
00005  * This work contains proprietary information of RSA Security.
00006  * Distribution is limited to authorized licensees of RSA
00007  * Security. Any unauthorized reproduction, distribution or
00008  * modification of this work is strictly prohibited.
00009  */
00010 
00016 #ifndef HEADER_COMMON_CERT_R_CERT_REQ_H
00017 #define HEADER_COMMON_CERT_R_CERT_REQ_H
00018 
00019 #ifdef  __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #ifndef NO_BIO
00024 #include "bio.h"
00025 #endif /* !NO_BIO */
00026 #include "r_format.h"
00027 #include "r_cert.h"
00028 
00052 /*
00053  * Exported macro constants
00054  */
00055 
00112 #define R_CERT_REQ_CTX_INFO_R_LIB_CTX       R_CERT_CTX_INFO_R_LIB_CTX
00113 
00129 #define R_CERT_REQ_CTX_INFO_CERT_REQ_TYPE   R_CERT_CTX_INFO_CERT_TYPE
00130 
00151 #define R_CERT_REQ_CTX_INFO_R_CR_CTX        R_CERT_CTX_INFO_R_CR_CTX
00152 
00173 #define R_CERT_REQ_CTX_INFO_R_PKEY_CTX      R_CERT_CTX_INFO_R_PKEY_CTX
00174 
00255 #define R_CERT_REQ_TYPE_PKCS10           10
00256 
00373 #define R_CERT_REQ_INFO_VERSION                PK_CERT_VER
00374 
00401 #define R_CERT_REQ_INFO_SUBJECT                PK_CERT_SUBJECT
00402 
00429 #define R_CERT_REQ_INFO_PUBLIC_KEY             PK_CERT_PUBKEY
00430 
00456 #define R_CERT_REQ_INFO_ATTRIBUTES             PK_CERT_REQ_ATTRIBUTES
00457 
00485 #define R_CERT_REQ_INFO_TO_BE_SIGNED           PK_CERT_BODY
00486 
00513 #define R_CERT_REQ_INFO_SIGNATURE              PK_CERT_SIGNATURE
00514 
00542 #define R_CERT_REQ_INFO_ALL                    R_CERT_INFO_ALL
00543 
00558 #define R_CERT_REQ_INFO_TYPE                   R_CERT_INFO_TYPE
00559 
00576 #define R_CERT_REQ_INFO_R_CERT_REQ_CTX         R_CERT_INFO_R_CERT_CTX
00577 
00592 #define R_CERT_REQ_INFO_VERSION_STRING         R_CERT_INFO_VERSION_STRING
00593 
00609 #define R_CERT_REQ_INFO_SIGNATURE_TYPE         R_CERT_INFO_SIGNATURE_TYPE
00610 
00626 #define R_CERT_REQ_INFO_SIGNATURE_DIGEST_TYPE  R_CERT_INFO_SIGNATURE_DIGEST_TYPE
00627 
00647 #define R_CERT_REQ_INFO_R_PKEY                 R_CERT_INFO_R_PKEY
00648 
00667 #define R_CERT_REQ_INFO_SUBJECT_R_CERT_NAME    R_CERT_INFO_SUBJECT_R_CERT_NAME
00668 
00692 #define R_CERT_REQ_INFO_PARAMETERS            R_CERT_INFO_PARAMETERS
00693 
00715 #define R_CERT_REQ_INFO_KEY_USAGE_INT         R_CERT_INFO_KEY_USAGE_INT
00716 
00749 #define R_CERT_REQ_FLAG_DEFAULT          0x0000
00750 
00772 #define R_CERT_REQ_FLAG_COPY_DATA        0x0000
00773 
00795 #define R_CERT_REQ_FLAG_BY_REFERENCE     0x0001
00796 
00801 /* Indicates that the request is binary encoded. */
00802 #define R_CERT_REQ_FORMAT_BINARY            R_FORMAT_BINARY
00803 
00804 /* Indicates that the request is text format encoded. */
00805 #define R_CERT_REQ_FORMAT_TEXT              R_FORMAT_TEXT
00806 
00807 /* Indicates that the request is Privacy Enhanced Mail (PEM) encoded. */
00808 #define R_CERT_REQ_FORMAT_PEM               R_FORMAT_PEM
00809 
00810 /* Indicates that the request is in a C code function format. */
00811 #define R_CERT_REQ_FORMAT_CODE_BINARY       R_FORMAT_CODE_BINARY
00812 
00813 /* Indicates that the request is in a C code fields format. */
00814 #define R_CERT_REQ_FORMAT_CODE_FIELDS       R_FORMAT_CODE_FIELDS
00815 
00816 /* Indicates that the request is in a C code data format. */
00817 #define R_CERT_REQ_FORMAT_CODE_HEX          R_FORMAT_CODE_HEX
00818 
00819 /* Indicates that the request is in a plain hexadecimal Bytes format. */
00820 #define R_CERT_REQ_FORMAT_HEX               R_FORMAT_HEX
00821 
00822 /* Backwards compatibility macro for R_CERT_REQ_FORMAT_from_string */
00823 #define R_CERT_REQ_FORMAT_from_string(str, fmt)       \
00824     R_FORMAT_from_string((str), (fmt))
00825 
00826 /* Backwards compatibility macro for R_CERT_REQ_FORMAT_to_string */
00827 #define R_CERT_REQ_FORMAT_to_string(fmt, max, str)    \
00828     R_FORMAT_to_string((fmt), (max), (str))
00829 
00830 /*
00831  * Exported types
00832  */
00833 
00844 typedef struct r_cert_ctx_st    R_CERT_REQ_CTX;
00845 
00847 typedef struct r_cert_st        R_CERT_REQ;
00848 
00852 typedef int R_CERT_REQ_TYPE;
00853 
00857 typedef int R_CERT_REQ_INFO;
00858 
00862 typedef int R_CERT_REQ_CTX_INFO;
00863 
00867 typedef int R_CERT_REQ_FLAG;
00868 
00890 #if defined(Rm_CERT_TABLE) || defined(Rm_CERT_DIRECT)
00891 
00892 /* Only include the extension header when building a small application */
00893 #include "rx_cert_req.h"
00894 
00895 #endif /* defined(Rm_CERT_TABLE) || defined(rm_CERT_DIRECT) */
00896 
00905 #ifndef Rm_CERT_DIRECT
00906 
00907 int R_CDECL R_CERT_REQ_CTX_new(R_LIB_CTX *lib_ctx, R_RES_FLAG flag,
00908     R_CERT_REQ_TYPE type, R_CERT_REQ_CTX **req_ctx);
00909 
00910 #endif /* Rm_CERT_DIRECT */
00911 
00912 
00913 #ifndef Rm_CERT_DIRECT
00914 
00929 #define R_CERT_REQ_CTX_free(req_ctx) \
00930     R_CERT_CTX_free(req_ctx)
00931 #endif /* Rm_CERT_DIRECT */
00932 
00933 #ifndef Rm_CERT_DIRECT
00934 
00954 #define R_CERT_REQ_CTX_get_info(req_ctx, info_id, value) \
00955     R_CERT_CTX_get_info((req_ctx), (info_id), (value))
00956 #endif /* Rm_CERT_DIRECT */
00957 
00958 
00959 #ifndef Rm_CERT_DIRECT
00960 
00980 #define R_CERT_REQ_CTX_set_info(req_ctx, info_id, value) \
00981     R_CERT_CTX_set_info((req_ctx), (info_id), (value))
00982 #endif /* Rm_CERT_DIRECT */
00983 
01006 #ifndef NO_BIO
01007 typedef int  R_CDECL R_CERT_REQ_PRINT_FUNC_T(BIO *bio, R_CERT_REQ *req,
01008     R_FORMAT format, char *format_arg);
01009 #else
01010 typedef int  R_CDECL R_CERT_REQ_PRINT_FUNC_T(void *bio, R_CERT_REQ *req,
01011     R_FORMAT format, char *format_arg);
01012 #endif
01013 
01014 
01015 #ifndef Rm_CERT_DIRECT
01016 
01037 #define R_CERT_REQ_new(req_ctx, type, req) \
01038     R_CERT_new(req_ctx, type, req)
01039 #endif /* Rm_CERT_DIRECT */
01040 
01041 
01042 #ifndef Rm_CERT_DIRECT
01043 
01060 #define R_CERT_REQ_free(req)        R_CERT_free(req)
01061 #endif /* Rm_CERT_DIRECT */
01062 
01063 
01064 #ifndef Rm_CERT_DIRECT
01065 
01096 #define R_CERT_REQ_from_binary(req_ctx, flag, type, max_buf_len, buf, \
01097                                consumed_len, req) \
01098     R_CERT_from_binary(req_ctx, flag, type, max_buf_len, buf, consumed_len, req)
01099 #endif /* Rm_CERT_DIRECT */
01100 
01101 
01102 #ifndef Rm_CERT_DIRECT
01103 
01124 #define R_CERT_REQ_to_binary(req, max_buf_len, buf, out_len) \
01125     R_CERT_to_binary(req, max_buf_len, buf, out_len)
01126 #endif /* Rm_CERT_DIRECT */
01127 
01128 
01129 #ifndef Rm_CERT_DIRECT
01130 
01150 #define R_CERT_REQ_inc_reference(req)    R_CERT_inc_reference(req)
01151 #endif /* Rm_CERT_DIRECT */
01152 
01153 
01177 #define R_CERT_REQ_subject_name_to_string(req, max_str_len, str) \
01178     R_CERT_subject_name_to_string(req, max_str_len, str)
01179 
01180 #ifndef Rm_CERT_DIRECT
01181 
01202 #define R_CERT_REQ_public_key_to_R_PKEY(req, flag, pkey) \
01203     R_CERT_public_key_to_R_PKEY(req, flag, pkey)
01204 #endif /* Rm_CERT_DIRECT */
01205 
01206 
01207 /*
01208  * the get_*_info functions return references to the underlying binary
01209  * data for use by those routines that do not need to pull apart the
01210  * certificates in order to work with them and can simple extract the
01211  * mandatory pieces to work with
01212  *
01213  */
01214 
01215 #ifndef Rm_CERT_DIRECT
01216 
01235 #define R_CERT_REQ_get_info(req, info_id, value) \
01236     R_CERT_get_info(req, info_id, value)
01237 #endif /* Rm_CERT_DIRECT */
01238 
01239 
01240 #ifndef Rm_CERT_DIRECT
01241 
01260 #define R_CERT_REQ_set_info(req, info_id, value) \
01261     R_CERT_set_info(req, info_id, value)
01262 #endif /* Rm_CERT_DIRECT */
01263 
01264 
01285 #define R_CERT_REQ_subject_name_to_R_CERT_NAME(req, flag, subject) \
01286     R_CERT_subject_name_to_R_CERT_NAME(req, flag, subject)
01287 
01288 /* Crypto-related functions */
01289 
01290 #ifndef Rm_CERT_DIRECT
01291 
01313 #define R_CERT_REQ_verify(req, pkey, verified) \
01314     R_CERT_verify(req, pkey, verified)
01315 #endif /* Rm_CERT_DIRECT */
01316 
01317 
01318 #ifndef Rm_CERT_DIRECT
01319 
01342 #define R_CERT_REQ_sign(req, pkey, sign_type) \
01343     R_CERT_sign(req, pkey, sign_type)
01344 #endif /* Rm_CERT_DIRECT */
01345 
01371 #define R_CERT_REQ_fingerprint(req, md_type, max_buf_len, buf, out_len) \
01372     R_CERT_fingerprint(req, md_type, max_buf_len, buf, out_len)
01373 
01374 #ifndef Rm_CERT_DIRECT
01375 #ifndef NO_BIO
01376 int R_CDECL R_CERT_REQ_print(R_CERT_REQ *req, R_FORMAT format, char *format_arg,
01377     BIO *bio);
01378 #endif /* NO_BIO */
01379 #endif /* Rm_CERT_DIRECT */
01380 
01381 int R_CDECL R_CERT_to_R_CERT_REQ(R_CERT *cert, R_CERT_REQ_CTX *ctx,
01382                          R_CERT_REQ_TYPE type, R_CERT_REQ **req);
01383 
01384 int R_CDECL R_CERT_REQ_to_R_CERT(R_CERT_REQ *req, R_CERT_CTX *ctx, R_CERT_TYPE type,
01385                          R_CERT **cert);
01386 
01387 int R_CDECL R_CERT_REQ_TYPE_from_string(char *str, R_CERT_REQ_TYPE *type);
01388 int R_CDECL R_CERT_REQ_TYPE_to_string(R_CERT_REQ_TYPE type, unsigned int max_str_len,
01389                               char *str);
01390 int R_CDECL R_CERT_REQ_TYPE_to_PEM_header(R_CERT_REQ_TYPE type,
01391                          unsigned int max_str_len, char *str);
01392 
01393 #ifndef NO_BIO
01394 int R_CDECL R_CERT_REQ_read(R_CERT_REQ_CTX *ctx, BIO *bio, R_CERT_REQ_TYPE type,
01395                     R_FORMAT format, R_CERT_REQ **req);
01396 #endif /* !NO_BIO */
01397 int R_CDECL R_CERT_REQ_read_file(R_CERT_REQ_CTX *ctx, char *filename,
01398                          R_CERT_REQ_TYPE type, R_FORMAT format,
01399                          R_CERT_REQ **req);
01400 #ifndef NO_BIO
01401 int R_CDECL R_CERT_REQ_write(R_CERT_REQ *req, BIO *bio, R_FORMAT format,
01402                      void *format_arg);
01403 #endif /* !NO_BIO */
01404 int R_CDECL R_CERT_REQ_write_file(R_CERT_REQ *req, char *filename,
01405                           R_FORMAT format, void *format_arg);
01406 
01411 #ifdef  __cplusplus
01412 }
01413 #endif
01414 
01415 #endif /* HEADER_COMMON_CERT_R_CERT_REQ_H */
01416 

Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 072-001001-2100-001-000 - 2.1