You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ka...@apache.org on 2007/10/15 12:44:07 UTC

svn commit: r584724 - in /webservices/rampart/trunk/c/src: omxmlsec/openssl/x509.c util/rampart_encryption.c

Author: kaushalye
Date: Mon Oct 15 03:44:00 2007
New Revision: 584724

URL: http://svn.apache.org/viewvc?rev=584724&view=rev
Log:
We need to base64 encode the fingerprint of an X509 certificate

Modified:
    webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c

Modified: webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c?rev=584724&r1=584723&r2=584724&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c Mon Oct 15 03:44:00 2007
@@ -339,7 +339,6 @@
             return NULL;
         }
     }else if(OPENSSL_X509_INFO_FINGER == type){
-        int j = 0;
         const EVP_MD *digest = NULL;
         unsigned char md[EVP_MAX_MD_SIZE];
         unsigned int _n = 0;
@@ -347,12 +346,19 @@
         digest = EVP_sha1();/*If we use EVP_md5(); here we can get the digest from md5. */
         if(X509_digest(cert,digest,md,&_n))
         {
-            BIO_printf(out, "%s:", OBJ_nid2sn(EVP_MD_type(digest)));
+            /*BIO_printf(out, "%s:", OBJ_nid2sn(EVP_MD_type(digest)));
+            int j = 0;
             for (j=0; j<(int)_n; j++)
             {
                 BIO_printf (out, "%02X",md[j]);
                 if (j+1 != (int)_n) BIO_printf(out,":");
-            }
+            }*/
+            /*We need to base64 encode the digest value of the finger print*/
+            axis2_char_t *encoded_str = NULL;
+            
+            encoded_str = AXIS2_MALLOC(env->allocator, axutil_base64_encode_len(_n));
+            axutil_base64_encode(encoded_str, (char*)md, SHA_DIGEST_LENGTH);
+            BIO_printf(out, "%s", encoded_str);  
         }
     }else if(OPENSSL_X509_INFO_SIGNATURE == type){
         int i = 0;

Modified: webservices/rampart/trunk/c/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_encryption.c?rev=584724&r1=584723&r2=584724&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Mon Oct 15 03:44:00 2007
@@ -29,6 +29,7 @@
 #include <oxs_axiom.h>
 #include <oxs_asym_ctx.h>
 #include <oxs_xml_encryption.h>
+#include <oxs_derivation.h>
 #include <axis2_key_type.h>
 #include <oxs_derivation.h>