axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r517172 - in /webservices/axis2/trunk/c/rampart: include/oxs_key_mgr.h src/omxmlsec/key_mgr.c
Date Mon, 12 Mar 2007 11:05:31 GMT
Author: kaushalye
Date: Mon Mar 12 04:05:30 2007
New Revision: 517172

URL: http://svn.apache.org/viewvc?view=rev&rev=517172
Log:
Adding a new method to Key Manager in OMXMLSecurity to read a PKCS12 key store.

Modified:
    webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c

Modified: webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h?view=diff&rev=517172&r1=517171&r2=517172
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h Mon Mar 12 04:05:30 2007
@@ -68,6 +68,14 @@
 AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
 oxs_key_mgr_load_x509_cert_from_string(const axis2_env_t *env,
     axis2_char_t *pem_buf);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_mgr_read_pkcs12_key_store(const axis2_env_t *env,
+    axis2_char_t *pkcs12_file,
+    axis2_char_t *password,
+    oxs_x509_cert_t **cert,
+    openssl_pkey_t **prv_key);
+    
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c?view=diff&rev=517172&r1=517171&r2=517172
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c Mon Mar 12 04:05:30 2007
@@ -21,6 +21,8 @@
 #include <oxs_key_mgr.h>
 #include <openssl_pem.h>
 
+
+
 /**
  * Loads the key
  * 1. If the key buffer is specified, Take that as the source.
@@ -258,4 +260,34 @@
     oxs_cert = oxs_key_mgr_convert_to_x509(env, cert);
 
     return oxs_cert; 
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_mgr_read_pkcs12_key_store(const axis2_env_t *env,
+    axis2_char_t *filename,
+    axis2_char_t *password,
+    oxs_x509_cert_t **cert,
+    openssl_pkey_t **prv_key)
+{
+    X509 *c = NULL;
+    STACK_OF(X509) *ca = NULL;
+    EVP_PKEY *pkey = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+
+    status = openssl_x509_load_from_pkcs12(env, filename, password, &c, &pkey, &ca);
+    if(AXIS2_FAILURE == status){
+        oxs_error(env, ERROR_LOCATION, OXS_ERROR_DEFAULT,
+                      "Error reading the PKCS12 Key Store");
+        return AXIS2_FAILURE;
+    } 
+    if(pkey){
+        *prv_key = openssl_pkey_create(env);
+        OPENSSL_PKEY_POPULATE(*prv_key, env, pkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+    }
+    
+    if(c){
+        *cert = oxs_key_mgr_convert_to_x509(env, c);       
+    }
+
+    return AXIS2_SUCCESS;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message