axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manj...@apache.org
Subject svn commit: r518504 - in /webservices/axis2/trunk/c/rampart: samples/keys/ahome/ src/omxmlsec/openssl/ src/omxmlsec/tokens/ src/util/
Date Thu, 15 Mar 2007 07:42:10 GMT
Author: manjula
Date: Thu Mar 15 00:42:08 2007
New Revision: 518504

URL: http://svn.apache.org/viewvc?view=rev&rev=518504
Log:
Modified x509.c to remove \n from buffer.

Modified:
    webservices/axis2/trunk/c/rampart/samples/keys/ahome/a_cert.cert
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pem.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_signature.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_token_processor.c

Modified: webservices/axis2/trunk/c/rampart/samples/keys/ahome/a_cert.cert
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/keys/ahome/a_cert.cert?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/keys/ahome/a_cert.cert (original)
+++ webservices/axis2/trunk/c/rampart/samples/keys/ahome/a_cert.cert Thu Mar 15 00:42:08 2007
@@ -1,47 +1,3 @@
-Certificate:
-    Data:
-        Version: 3 (0x2)
-        Serial Number:
-            dc:83:fa:3c:1e:93:11:ae
-        Signature Algorithm: sha1WithRSAEncryption
-        Issuer: C=SL, ST=WP, O=WS, OU=C, CN=Kaushalye/emailAddress=kaus@wso2.com
-        Validity
-            Not Before: Dec  6 10:27:18 2006 GMT
-            Not After : Dec  6 10:27:18 2007 GMT
-        Subject: C=SL, ST=WP, L=Katubedda, O=WS, OU=C, CN=Aaa/emailAddress=aaa@ws.com
-        Subject Public Key Info:
-            Public Key Algorithm: rsaEncryption
-            RSA Public Key: (1024 bit)
-                Modulus (1024 bit):
-                    00:c7:e1:d8:5c:ef:16:dd:5d:05:95:c8:16:7c:2f:
-                    f5:13:15:b4:7a:0c:c8:fb:95:c8:03:db:3d:a8:41:
-                    5d:70:75:ce:27:15:e2:a3:ef:87:24:38:5a:ee:72:
-                    ea:70:c2:45:44:b5:dd:46:ca:51:60:15:ac:51:c3:
-                    59:af:a8:17:85:af:cd:77:74:87:b2:4b:ab:13:e0:
-                    00:82:2f:2a:d0:6b:12:7d:09:dc:52:dc:16:10:58:
-                    46:38:74:c7:cf:98:96:e3:58:ce:8a:c8:31:fa:77:
-                    6c:69:65:dc:a1:4c:38:e7:b0:9e:dc:64:06:ae:aa:
-                    13:90:23:62:84:14:c0:9e:31
-                Exponent: 65537 (0x10001)
-        X509v3 extensions:
-            X509v3 Basic Constraints: 
-                CA:FALSE
-            Netscape Comment: 
-                OpenSSL Generated Certificate
-            X509v3 Subject Key Identifier: 
-                67:B7:BC:8C:22:29:1E:17:58:C6:43:91:A6:FB:82:E7:11:77:62:D6
-            X509v3 Authority Key Identifier: 
-                keyid:D7:27:10:74:4B:F8:2F:44:0B:BC:C7:9E:04:EF:22:5B:15:18:21:CC
-
-    Signature Algorithm: sha1WithRSAEncryption
-        4d:36:00:f0:51:10:44:72:73:5f:09:e4:fe:ad:f4:5b:a0:48:
-        5f:50:50:d7:bb:bb:2a:98:b3:b7:d7:54:9e:57:6d:d2:cd:de:
-        d5:d5:30:4d:c7:03:09:b4:7d:d8:72:17:f7:c6:e8:72:69:89:
-        b9:bc:91:5a:a8:c8:9e:ee:76:0b:c2:ae:c2:65:59:94:5b:fe:
-        a2:30:bf:aa:49:25:b1:42:bc:6d:c4:0a:99:aa:2d:17:14:d8:
-        8d:19:cd:75:22:84:51:22:55:4e:e1:9e:50:1f:c6:c2:57:e1:
-        4b:58:87:d5:73:c1:69:fd:25:dd:3d:50:ee:0e:9f:6a:9a:13:
-        52:45
 -----BEGIN CERTIFICATE-----
 MIICzjCCAjegAwIBAgIJANyD+jwekxGuMA0GCSqGSIb3DQEBBQUAMGUxCzAJBgNV
 BAYTAlNMMQswCQYDVQQIEwJXUDELMAkGA1UEChMCV1MxCjAIBgNVBAsTAUMxEjAQ

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pem.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pem.c?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pem.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pem.c Thu Mar 15 00:42:08 2007
@@ -91,7 +91,7 @@
     BIO *bio;
     int ret; 
 
-    bio = BIO_new_file(filename, "rb");
+    bio = BIO_new_file(filename, "r");
 
     if(type == OPENSSL_PEM_PKEY_TYPE_PRIVATE_KEY){
         *pkey = PEM_read_bio_PrivateKey(bio, NULL, 0 , password);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c Thu Mar 15 00:42:08 2007
@@ -39,20 +39,31 @@
     int ilen = 0;
 
     /*First we need to base64 decode*/
-    EVP_ENCODE_CTX ctx;
-    int len = 0;
-    int ret = 0;
+/*  EVP_ENCODE_CTX ctx;*/
+/*  int len = 0;*/
+/*  int ret = 0;*/
     int decode_len = 0;
+    int decoded_len = -1;
 
     decode_len = axis2_base64_decode_len(b64_encoded_buf);
-    buff = AXIS2_MALLOC(env->allocator, decode_len + 1000);
+    buff = AXIS2_MALLOC(env->allocator, decode_len);
 
     ilen = axis2_strlen(b64_encoded_buf);
-    EVP_DecodeInit(&ctx);
+
+    decoded_len = axis2_base64_decode_binary(buff,b64_encoded_buf);
+    if (decoded_len < 0)
+    {
+        oxs_error(env, ERROR_LOCATION, OXS_ERROR_DECRYPT_FAILED,
+                    "axis2_base64_decode_binary failed");
+            return AXIS2_FAILURE;
+    }
+    
+/*  EVP_DecodeInit(&ctx);
     EVP_DecodeUpdate(&ctx, (unsigned char*)buff, &len,
                    (unsigned char*)b64_encoded_buf, ilen);
     EVP_DecodeFinal(&ctx, (unsigned char*)buff, &ret);
     ret += len;
+*/    
     if ((mem = BIO_new_mem_buf(buff, ilen)) == NULL)
     {
         /*oxs_error(env, ERROR_LOCATION, OXS_ERROR_DEFAULT,
@@ -187,13 +198,33 @@
     axis2_char_t *core_tail = NULL;
     axis2_char_t *core = NULL;
     axis2_char_t *res = NULL;
+    axis2_char_t *buffer = NULL;
+    int i = 0;
+    int j = 0;
     
     unformatted = openssl_x509_get_info(env, OPENSSL_X509_INFO_DATA_CERT, cert);
     core_tail = axis2_strstr(unformatted, "\n");
+    core_tail = core_tail+1;
     res = axis2_strstr(core_tail,"-----END");
+    res = res-1;
     res[0] = '\0';
-    core = (axis2_char_t*)AXIS2_STRDUP(core_tail,env); 
-    return core;
+    core = (axis2_char_t*)AXIS2_STRDUP(core_tail,env);
+    buffer = (axis2_char_t*)AXIS2_STRDUP(core,env);
+
+    while(core[i]!='\0')
+    {
+        if(core[i]!='\n')
+        {
+            buffer[j] = core[i];
+            j++;
+        }
+        i++;
+    }        
+    buffer[j]='\0';
+
+    AXIS2_FREE(env->allocator,core);
+    core = NULL;
+    return buffer;
 }
 
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c Thu
Mar 15 00:42:08 2007
@@ -21,7 +21,7 @@
 #include <oxs_utility.h>
 #include <axiom_attribute.h>
 #include <axiom_element.h>
-
+#include <rampart_constants.h>
 
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
 oxs_token_build_binary_security_token_element(const axis2_env_t *env,
@@ -39,10 +39,13 @@
     axiom_attribute_t *id_attr = NULL;
     int ret;
     axiom_namespace_t *ns_obj = NULL;
+    axiom_namespace_t *ns = NULL;
 
     ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
             OXS_WSSE);
 
+    ns = axiom_namespace_create(env,RAMPART_WSU_XMLNS,OXS_WSU);
+
     binary_security_token_ele = axiom_element_create(env, parent, OXS_NODE_BINARY_SECURITY_TOKEN,
ns_obj, &binary_security_token_node);
     if (!binary_security_token_ele)
     {
@@ -67,7 +70,7 @@
     }
 
     
-    id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL);
+    id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id,ns);
     encoding_type_att =  axiom_attribute_create(env, OXS_ATTR_ENCODING_TYPE, encoding_type,
NULL);
     value_type_att =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);
 

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_signature.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_signature.c?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_signature.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_signature.c Thu Mar 15 00:42:08 2007
@@ -182,7 +182,7 @@
         }            
         
         bst_node = oxs_token_build_binary_security_token_element(env,sec_node, 
-                cert_id , OXS_VALUE_X509V3, OXS_ENCODING_BASE64BINARY, bst_data); 
+                cert_id , OXS_ENCODING_BASE64BINARY, OXS_VALUE_X509V3, bst_data); 
         if(!bst_node)
         {
             AXIS2_LOG_INFO(env->log,"[rampart][rampart_signature] Binary Security Token
creation failed.");
@@ -217,7 +217,7 @@
             tr = oxs_transforms_factory_produce_transform(env, OXS_HREF_TRANSFORM_XML_EXC_C14N);
             axis2_array_list_add(tr_list, env, tr);
             oxs_sign_part_set_transforms(sign_part, env, tr_list);                      
             
-            oxs_axiom_add_attribute(env, node_to_sign, OXS_WSU, OXS_WSSE_XMLNS,OXS_ATTR_ID,id);
+            oxs_axiom_add_attribute(env, node_to_sign, OXS_WSU,RAMPART_WSU_XMLNS,OXS_ATTR_ID,id);
             oxs_sign_part_set_node(sign_part, env,node_to_sign);
             oxs_sign_part_set_digest_mtd(sign_part, env, digest_method);
             axis2_array_list_add(sign_parts, env, sign_part);

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_token_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_token_processor.c?view=diff&rev=518504&r1=518503&r2=518504
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_token_processor.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_token_processor.c Thu Mar 15 00:42:08
2007
@@ -81,7 +81,7 @@
     ref_id = axis2_string_substring_starting_at(axis2_strdup(ref, env), 1);
 
     /*Find the token with the id=ref_id within the scope of scope_node*/
-    bst_node = oxs_axiom_get_node_by_id(env, scope_node, OXS_ATTR_ID, ref_id);
+    bst_node = oxs_axiom_get_node_by_id(env, scope_node,"wsu:Id",ref_id);
     if(!bst_node){
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_ELEMENT_FAILED, "Error retrieving element
with ID=%s", ref_id);
         return AXIS2_FAILURE;



---------------------------------------------------------------------
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