# 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_COMMON_NAME
    00061     } openssl_x509_info_type_t;
    00062
    00063     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00064     openssl_x509_load_from_buffer(const axutil_env_t *env,
    00065                                   axis2_char_t *b64_encoded_buf,
    00066                                   X509 **cert);
    00067
    00068     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00069     openssl_x509_load_from_pem(const axutil_env_t *env,
    00070                                axis2_char_t *filename,
    00071                                X509 **cert);
    00072
    00073     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00074     openssl_x509_load_from_pkcs12(const axutil_env_t *env,
    00075                                   axis2_char_t *filename,
    00076                                   axis2_char_t *password,
    00077                                   X509 **cert,
    00078                                   EVP_PKEY **pkey,
    00079                                   STACK_OF(X509) **ca);
    00080
    00081     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00082     openssl_x509_load_certificate(const axutil_env_t *env,
    00083                                   openssl_x509_format_t format,
    00084                                   axis2_char_t *filename,
    00085                                   axis2_char_t *password,
    00086                                   X509 **cert);
    00087
    00088     /*Caller MUST free */
    00089     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00090     openssl_x509_get_cert_data(const axutil_env_t *env,
    00091                                X509 *cert);
    00092
    00093
    00094     AXIS2_EXTERN int AXIS2_CALL
    00095     openssl_x509_get_serial(const axutil_env_t *env,
    00096                             X509 *cert);
    00097
    00098     AXIS2_EXTERN unsigned long AXIS2_CALL
    00099     openssl_x509_get_subject_name_hash(const axutil_env_t *env,
    00100                                        X509 *cert);
    00101
    00102     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00103     openssl_x509_get_pubkey(const axutil_env_t *env,
    00104                             X509 *cert,
    00105                             EVP_PKEY **pubkey);
    00106
    00107     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00108     openssl_x509_get_subject_key_identifier(const axutil_env_t *env,
    00109                                             X509 *cert);
    00110
    00111     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00112     openssl_x509_get_info(const axutil_env_t *env,
    00113                           openssl_x509_info_type_t type,
    00114                           X509 *cert);
    00115
    00116         AXIS2_EXTERN axis2_char_t * AXIS2_CALL
    00117     openssl_x509_get_common_name(
    00118         const axutil_env_t *env,
    00119         X509 *cert);
    00120
    00121     AXIS2_EXTERN void AXIS2_CALL
    00122     openssl_x509_print(const axutil_env_t *env,
    00123                        X509 *cert);
    00124
    00126 #ifdef __cplusplus
    00127 }
    00128 #endif
    00129
    00130 #endif    /* OPENSSL_X509_H */