openssl_x509.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
00015  */
00016 
00017 #include <openssl/rand.h>
00018 #include <openssl/evp.h>
00019 #include <openssl/pem.h>
00020 #include <openssl/bio.h>
00021 #include <openssl/rand.h>
00022 #include <openssl_constants.h>
00023 #include <openssl_pkey.h>
00024 #include <axis2_util.h>
00025 #include <openssl/pkcs12.h>
00026 #include <oxs_error.h>
00031 #ifndef OPENSSL_X509_H
00032 #define OPENSSL_X509_H
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00043     typedef enum {
00044         OPENSSL_X509_FORMAT_PEM = 0,
00045         OPENSSL_X509_FORMAT_DER,
00046         OPENSSL_X509_FORMAT_PKCS12
00047     } openssl_x509_format_t;
00048 
00049     typedef enum {
00050         OPENSSL_X509_INFO_SUBJECT = 0,
00051         OPENSSL_X509_INFO_ISSUER ,
00052         OPENSSL_X509_INFO_VALID_FROM ,
00053         OPENSSL_X509_INFO_VALID_TO ,
00054         OPENSSL_X509_INFO_FINGER ,
00055         OPENSSL_X509_INFO_SIGNATURE ,
00056         OPENSSL_X509_INFO_VERSION ,
00057         OPENSSL_X509_INFO_PUBKEY ,
00058         OPENSSL_X509_INFO_PUBKEY_ALGO ,
00059         OPENSSL_X509_INFO_DATA_CERT
00060     } openssl_x509_info_type_t;
00061 
00062     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00063     openssl_x509_load_from_buffer(const axutil_env_t *env,
00064                                   axis2_char_t *b64_encoded_buf,
00065                                   X509 **cert);
00066 
00067     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00068     openssl_x509_load_from_pem(const axutil_env_t *env,
00069                                axis2_char_t *filename,
00070                                X509 **cert);
00071 
00072     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00073     openssl_x509_load_from_pkcs12(const axutil_env_t *env,
00074                                   axis2_char_t *filename,
00075                                   axis2_char_t *password,
00076                                   X509 **cert,
00077                                   EVP_PKEY **pkey,
00078                                   STACK_OF(X509) **ca);
00079 
00080     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00081     openssl_x509_load_certificate(const axutil_env_t *env,
00082                                   openssl_x509_format_t format,
00083                                   axis2_char_t *filename,
00084                                   axis2_char_t *password,
00085                                   X509 **cert);
00086 
00087     /*Caller MUST free */
00088     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
00089     openssl_x509_get_cert_data(const axutil_env_t *env,
00090                                X509 *cert);
00091 
00092 
00093     AXIS2_EXTERN int AXIS2_CALL
00094     openssl_x509_get_serial(const axutil_env_t *env,
00095                             X509 *cert);
00096 
00097     AXIS2_EXTERN unsigned long AXIS2_CALL
00098     openssl_x509_get_subject_name_hash(const axutil_env_t *env,
00099                                        X509 *cert);
00100 
00101     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00102     openssl_x509_get_pubkey(const axutil_env_t *env,
00103                             X509 *cert,
00104                             EVP_PKEY **pubkey);
00105 
00106     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
00107     openssl_x509_get_subject_key_identifier(const axutil_env_t *env,
00108                                             X509 *cert);
00109 
00110     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
00111     openssl_x509_get_info(const axutil_env_t *env,
00112                           openssl_x509_info_type_t type,
00113                           X509 *cert);
00114 
00115     AXIS2_EXTERN void AXIS2_CALL
00116     openssl_x509_print(const axutil_env_t *env,
00117                        X509 *cert);
00118 
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123 
00124 #endif    /* OPENSSL_X509_H */

Generated on Thu Oct 4 17:37:07 2007 for Rampart/C by  doxygen 1.4.7