axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r500230 - in /webservices/axis2/trunk/c/rampart: include/openssl_digest.h src/omxmlsec/openssl/digest.c src/omxmlsec/openssl/x509.c test/openssl/rsa/test_rsa.c
Date Fri, 26 Jan 2007 12:38:22 GMT
Author: kaushalye
Date: Fri Jan 26 04:38:20 2007
New Revision: 500230

URL: http://svn.apache.org/viewvc?view=rev&rev=500230
Log:
Adding md5 digest 

Modified:
    webservices/axis2/trunk/c/rampart/include/openssl_digest.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/digest.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c
    webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c

Modified: webservices/axis2/trunk/c/rampart/include/openssl_digest.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_digest.h?view=diff&rev=500230&r1=500229&r2=500230
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_digest.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_digest.h Fri Jan 26 04:38:20 2007
@@ -46,7 +46,10 @@
                 axis2_char_t *input,
                 int length);
                                                                             
-
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_md5(const axis2_env_t *env,
+            axis2_char_t *input,
+            int length);
 /* @} */
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/digest.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/digest.c?view=diff&rev=500230&r1=500229&r2=500230
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/digest.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/digest.c Fri Jan 26 04:38:20 2007
@@ -17,8 +17,10 @@
 
 #include <stdio.h>
 #include <openssl/sha.h>
+#include <openssl/md5.h>
 #include <openssl_digest.h>
 #include <axis2_base64.h>
+#include <axis2_util.h>
 
 #define SIZE_HASH 32
 
@@ -41,6 +43,23 @@
     return encoded_str;
 }
 
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_md5(const axis2_env_t *env,
+            axis2_char_t *input,
+            int length)
+{
+    MD5_CTX ctx;
+    unsigned char md[MD5_DIGEST_LENGTH]; 
+    axis2_char_t* encoded_str = NULL;
+ 
+    MD5_Init(&ctx);
+    MD5_Update(&ctx, (unsigned char*)input,length);
+    MD5_Final(md, &ctx); 
+    
+    encoded_str = AXIS2_MALLOC(env->allocator, MD5_DIGEST_LENGTH);
+    axis2_base64_encode(encoded_str, (char*)md, MD5_DIGEST_LENGTH);
 
+    return encoded_str;
+}
 
 

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=500230&r1=500229&r2=500230
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c Fri Jan 26 04:38:20 2007
@@ -55,8 +55,8 @@
     ret += len;
     if ((mem = BIO_new_mem_buf(buff, ilen)) == NULL)
     {
-        oxs_error(env, ERROR_LOCATION, OXS_ERROR_DEFAULT,
-                "BIO memeory allocation failure");
+        /*oxs_error(env, ERROR_LOCATION, OXS_ERROR_DEFAULT,
+                "BIO memeory allocation failure");*/
         return AXIS2_FAILURE;
     }
 

Modified: webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c?view=diff&rev=500230&r1=500229&r2=500230
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c (original)
+++ webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c Fri Jan 26 04:38:20 2007
@@ -22,11 +22,10 @@
 #include <oxs_buffer.h>
 #include <oxs_error.h>
 #include <openssl_rsa.h>
+#include <openssl_digest.h>
 #include <openssl_constants.h>
 #include <oxs_axis2_utils.h>
 
-
-
 axis2_env_t *test_init()
 {
     axis2_allocator_t *allocator = axis2_allocator_init(NULL);
@@ -35,6 +34,18 @@
     return env;
 }
 
+int md5(){
+    axis2_env_t *env = NULL;
+    axis2_char_t *plaintext = NULL;
+
+    env = test_init();
+    plaintxt = (unsigned char *)"We will we will rock ya...";
+
+    openssl_md5(env, plaintxt , AXIS2_STRLEN(plaintxt));    
+    printf("Finish  md5() \n");
+    return 0;
+}
+
 int encdec()
 {
     axis2_env_t *env = NULL;
@@ -84,6 +95,7 @@
 
 int main()
 {
-    return encdec();
+/*    return encdec();*/
+    return md5();
 
 }



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