You are viewing a plain text version of this content. The canonical link for it is here.
Posted to juice-svn@xml.apache.org by bl...@apache.org on 2006/02/21 10:27:43 UTC
svn commit: r379398 - /incubator/juice/native/src/
Author: blautenb
Date: Tue Feb 21 01:27:39 2006
New Revision: 379398
URL: http://svn.apache.org/viewcvs?rev=379398&view=rev
Log:
Moved new code into src from srcNew
Added:
incubator/juice/native/src/InitializeOpenSSL.c
incubator/juice/native/src/JCEBlockCipherOpenSSL.c
incubator/juice/native/src/JCERSACipherOpenSSL.c
incubator/juice/native/src/JDKDSASignerOpenSSL.c
incubator/juice/native/src/JDKMessageDigestOpenSSL.c
incubator/juice/native/src/openSSL4Java.sh
incubator/juice/native/src/org_apache_security_juice_provider_InitializeOpenSSL.h
incubator/juice/native/src/org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h
incubator/juice/native/src/org_apache_security_juice_provider_JCERSACipherOpenSSL.h
incubator/juice/native/src/org_apache_security_juice_provider_JDKDSASignerOpenSSL.h
incubator/juice/native/src/org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h
Removed:
incubator/juice/native/src/digest.c
incubator/juice/native/src/digest.h
incubator/juice/native/src/dsa.c
incubator/juice/native/src/juice.h
incubator/juice/native/src/md5.c
incubator/juice/native/src/random.c
incubator/juice/native/src/rsa.c
incubator/juice/native/src/sha-1.c
Modified:
incubator/juice/native/src/Makefile.am
Added: incubator/juice/native/src/InitializeOpenSSL.c
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/InitializeOpenSSL.c?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/InitializeOpenSSL.c (added)
+++ incubator/juice/native/src/InitializeOpenSSL.c Tue Feb 21 01:27:39 2006
@@ -0,0 +1,102 @@
+#include <stdio.h>
+#include <openssl/evp.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <openssl/crypto.h>
+#include <jni.h>
+#include "org_apache_security_juice_provider_InitializeOpenSSL.h"
+
+/*
+ * Variable use throughout this module to access the Java lock and unlock
+ * methods.
+ */
+
+static jmethodID lockMethod = 0;
+static jmethodID unlockMethod = 0;
+static jobject javaInitializeObject = 0;
+static JNIEnv *envGlobal = 0;
+
+void java_locking_callback(int mode, int type, char *file, int line);
+
+/*
+ * Class: org_apache_security_juice_provider_InitializeOpenSSL
+ * Method: getNumLocks
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_InitializeOpenSSL_getNumLocks
+(JNIEnv *env, jobject jobj) {
+
+ int numLocks = 0;
+ jclass clazz = 0;
+
+ numLocks = CRYPTO_num_locks();
+
+ clazz = (*env)->GetObjectClass(env, jobj);
+ if (clazz == 0) {
+ return -1;
+ }
+
+ lockMethod = (*env)->GetMethodID(env, clazz, "setLock", "(I)V");
+ unlockMethod = (*env)->GetMethodID(env, clazz, "clearLock", "(I)V");
+
+ if (lockMethod == 0 && unlockMethod == 0) {
+ return -2;
+ }
+
+ /*
+ * create a global reference to the InitializeOpenSSL instance to lock it in memory
+ */
+ javaInitializeObject = (*env)->NewGlobalRef(env, jobj);
+ if (javaInitializeObject == 0) {
+ return -3;
+ }
+
+// CRYPTO_set_id_callback((unsigned long (*)())java_thread_id);
+ CRYPTO_set_locking_callback((void (*)())java_locking_callback);
+
+ envGlobal = env;
+ return numLocks;
+}
+
+
+/*
+ * Class: org_apache_security_juice_provider_InitializeOpenSSL
+ * Method: initializeOpenSSL
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_InitializeOpenSSL_initializeOpenSSL
+(JNIEnv *env, jobject jobj) {
+
+ (*envGlobal)->CallVoidMethod(envGlobal, javaInitializeObject, lockMethod, -1);
+ (*envGlobal)->CallVoidMethod(envGlobal, javaInitializeObject, unlockMethod, -1);
+ OpenSSL_add_all_ciphers();
+ OpenSSL_add_all_digests();
+ return 1;
+}
+
+void java_locking_callback(int mode, int type, char *file,
+ int line) {
+#ifdef undef
+ fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
+ CRYPTO_thread_id(),
+ (mode&CRYPTO_LOCK)?"l":"u",
+ (type&CRYPTO_READ)?"r":"w",file,line);
+#endif
+ if (mode & CRYPTO_LOCK) {
+ (*envGlobal)->CallVoidMethod(envGlobal, javaInitializeObject, lockMethod, type);
+ }
+ else {
+ (*envGlobal)->CallVoidMethod(envGlobal, javaInitializeObject, unlockMethod, type);
+ }
+}
+
+unsigned long java_thread_id(void) {
+ unsigned long ret;
+
+/*
+ * This could probably be done via Thread.currentThread() and convert the Thread reference
+ * to a long - needs to be evaluated.
+ */
+// ret=(unsigned long)pthread_self();
+ return(ret);
+}
Added: incubator/juice/native/src/JCEBlockCipherOpenSSL.c
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/JCEBlockCipherOpenSSL.c?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/JCEBlockCipherOpenSSL.c (added)
+++ incubator/juice/native/src/JCEBlockCipherOpenSSL.c Tue Feb 21 01:27:39 2006
@@ -0,0 +1,269 @@
+#include <stdio.h>
+#include <openssl/evp.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <jni.h>
+#include "org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+void hexdump1(FILE *f,const char *title,const unsigned char *s,int l) {
+ int n=0;
+
+ fprintf(f,"%s",title);
+ for( ; n < l ; ++n)
+ {
+ if((n%16) == 0)
+ fprintf(f,"\n%04x",n);
+ fprintf(f," %02x",s[n]);
+ }
+ fprintf(f,"\n");
+}
+
+
+/*
+ * Class: org_bouncycastle_jce_provider_JCEBlockCipherOpenSSL
+ * Method: initOpenSSLEvp
+ * Signature: (Ljava/lang/String;Z[BI[BI)J
+ */
+
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_initOpenSSLEvp
+(JNIEnv *env, jobject jobj, jstring algoName, jboolean encrypt, jbyteArray key, jint klen, jbyteArray iv, jint ivlen, jint pad) {
+
+ const EVP_CIPHER *c;
+ EVP_CIPHER_CTX *ctx;
+ int ret = 0;
+
+ const char *algo = (*env)->GetStringUTFChars(env, algoName, 0);
+
+ c=EVP_get_cipherbyname(algo);
+ if(!c) {
+ fprintf(stderr,"Algorithm not found %s\n", algo);
+ return 0L;
+ }
+ (*env)->ReleaseStringUTFChars(env, algoName, algo);
+
+ if(klen != c->key_len) {
+ fprintf(stderr,"Key length doesn't match, got %d expected %d\n",klen,
+ c->key_len);
+ return 0;
+ }
+ ctx = malloc(sizeof (EVP_CIPHER_CTX));
+
+ EVP_CIPHER_CTX_init(ctx);
+
+ if (ivlen > 0) {
+ jbyte *keyBytes = (*env)->GetByteArrayElements(env, key, 0);
+ jbyte *ivBytes = (*env)->GetByteArrayElements(env, iv, 0);
+ ret = EVP_CipherInit_ex(ctx, c, NULL, keyBytes, ivBytes, encrypt);
+ (*env)->ReleaseByteArrayElements(env, iv, ivBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, key, keyBytes, 0);
+
+ if (pad == org_apache_security_juice_provider_JCEBlockCipherOpenSSL_NOPAD) {
+ ctx->flags |= EVP_CIPH_NO_PADDING;
+ }
+
+ if(ret == 0) {
+ fprintf(stderr,"EncryptInit failed\n");
+ ERR_print_errors_fp(stderr);
+ EVP_CIPHER_CTX_cleanup(ctx);
+ free(ctx);
+ return 0;
+ }
+ }
+ else {
+ jbyte *keyBytes = (*env)->GetByteArrayElements(env, key, 0);
+ ret = EVP_CipherInit_ex(ctx, c, NULL, key, 0, encrypt);
+ (*env)->ReleaseByteArrayElements(env, key, keyBytes, 0);
+ if(ret == 0) {
+ fprintf(stderr,"EncryptInit failed\n");
+ ERR_print_errors_fp(stderr);
+ EVP_CIPHER_CTX_cleanup(ctx);
+ free(ctx);
+ return 0;
+ }
+ }
+ return (unsigned long)ctx;
+}
+
+
+/*
+ * Class: org_bouncycastle_jce_provider_JCEBlockCipherOpenSSL
+ * Method: processBytesOpenSSL
+ * Signature: ([BII[BII)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_processBytesOpenSSL
+(JNIEnv *env, jobject jobj, jlong handle, jbyteArray input, jint inOff, jint inLen, jbyteArray output, jint outOff) {
+ int ret = 0;
+ int outLen = -1;
+
+ jbyte* inBytes, *outBytes;
+
+#if SIZEOF_INT_P == 4
+ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)handle;
+#endif
+
+ inBytes = (*env)->GetByteArrayElements(env, input, 0);
+ outBytes = (*env)->GetByteArrayElements(env, output, 0);
+
+ ret = EVP_CipherUpdate(ctx, outBytes+outOff, &outLen, inBytes+inOff, inLen);
+
+ (*env)->ReleaseByteArrayElements(env, input, inBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, output, outBytes, 0);
+
+ if(ret == 0) {
+ fprintf(stderr,"Process bytes failed\n");
+ ERR_print_errors_fp(stderr);
+ return -1;
+ }
+ return outLen;
+}
+
+
+/*
+ * Class: org_bouncycastle_jce_provider_JCEBlockCipherOpenSSL
+ * Method: doFinalOpenSSL
+ * Signature: (J[BI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_doFinalOpenSSL
+(JNIEnv *env, jobject jobj, jlong handle, jbyteArray output, jint outOff, jint pad) {
+ int ret = 0;
+ int outLen = -1;
+ jbyte* outBytes;
+
+#if SIZEOF_INT_P == 4
+ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)handle;
+#endif
+
+ outBytes = (*env)->GetByteArrayElements(env, output, 0);
+
+ if (ctx->encrypt) {
+ if (pad == org_apache_security_juice_provider_JCEBlockCipherOpenSSL_ISO10126) {
+ ret = EVP_EncryptFinal_ex_ISO10126(ctx, outBytes+outOff, &outLen);
+ }
+ else {
+ ret = EVP_EncryptFinal_ex(ctx, outBytes+outOff, &outLen);
+ }
+ }
+ else {
+ if (pad == org_apache_security_juice_provider_JCEBlockCipherOpenSSL_ISO10126) {
+ ret = EVP_DecryptFinal_ex_ISO10126(ctx, outBytes+outOff, &outLen);
+ }
+ else {
+ ret = EVP_DecryptFinal_ex(ctx, outBytes+outOff, &outLen);
+ }
+ }
+
+ (*env)->ReleaseByteArrayElements(env, output, outBytes, 0);
+
+ EVP_CIPHER_CTX_cleanup(ctx);
+ free(ctx);
+
+ if(ret == 0) {
+ fprintf(stderr,"Do final failed\n");
+ ERR_print_errors_fp(stderr);
+ return -1;
+ }
+ return outLen;
+}
+
+int EVP_EncryptFinal_ex_ISO10126(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
+{
+ int n,ret;
+ unsigned int i, b, bl;
+
+ b=ctx->cipher->block_size;
+ OPENSSL_assert(b <= sizeof ctx->buf);
+ if (b == 1)
+ {
+ *outl=0;
+ return 1;
+ }
+ bl=ctx->buf_len;
+ if (ctx->flags & EVP_CIPH_NO_PADDING)
+ {
+ if(bl)
+ {
+#ifdef EVP_F_EVP_ENCRYPTFINAL_EX
+ EVPerr(EVP_F_EVP_ENCRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+#else
+ EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+#endif
+ return 0;
+ }
+ *outl = 0;
+ return 1;
+ }
+
+ n=b-bl;
+ RAND_bytes(&ctx->buf[bl], b-1);
+ ctx->buf[b-1] = n;
+ ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b);
+
+
+ if(ret)
+ *outl=b;
+
+ return ret;
+}
+
+
+int EVP_DecryptFinal_ex_ISO10126(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
+{
+ int i,n;
+ unsigned int b;
+
+ *outl=0;
+ b=ctx->cipher->block_size;
+ if (ctx->flags & EVP_CIPH_NO_PADDING)
+ {
+ if(ctx->buf_len)
+ {
+#ifdef EVP_F_EVP_DECRYPTFINAL_EX
+ EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+#else
+ EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+#endif
+ return 0;
+ }
+ *outl = 0;
+ return 1;
+ }
+ if (b > 1)
+ {
+ if (ctx->buf_len || !ctx->final_used)
+ {
+#ifdef EVP_F_EVP_DECRYPTFINAL_EX
+ EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_WRONG_FINAL_BLOCK_LENGTH);
+#else
+ EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH);
+#endif
+ return(0);
+ }
+ OPENSSL_assert(b <= sizeof ctx->final);
+ n=ctx->final[b-1];
+ if (n > (int)b)
+ {
+#ifdef EVP_F_EVP_DECRYPTFINAL_EX
+ EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
+#else
+ EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
+#endif
+ return(0);
+ }
+ n=ctx->cipher->block_size-n;
+ for (i=0; i<n; i++)
+ out[i]=ctx->final[i];
+ *outl=n;
+ }
+ else
+ *outl=0;
+ return(1);
+}
+
Added: incubator/juice/native/src/JCERSACipherOpenSSL.c
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/JCERSACipherOpenSSL.c?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/JCERSACipherOpenSSL.c (added)
+++ incubator/juice/native/src/JCERSACipherOpenSSL.c Tue Feb 21 01:27:39 2006
@@ -0,0 +1,293 @@
+#include <stdio.h>
+#include <openssl/evp.h>
+#include <openssl/rsa.h>
+#include <openssl/bn.h>
+#include <jni.h>
+#include "org_apache_security_juice_provider_JCERSACipherOpenSSL.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: initOpenSSLRSA
+ * Signature: ([BI[BI[BI[BI[BI[BI[BI[BI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_initOpenSSLRSA (JNIEnv *env, jclass jobj,
+ jbyteArray n, jint nlen,
+ jbyteArray e, jint elen,
+ jbyteArray d, jint dlen,
+ jbyteArray p, jint plen,
+ jbyteArray q, jint qlen,
+ jbyteArray dmp1, jint dmp1len,
+ jbyteArray dmq1, jint dmq1len,
+ jbyteArray iqmp , jint iqmplen) {
+
+ jbyte *nb, *eb, *db, *pb, *qb, *dmp1b, *dmq1b, *iqmpb;
+
+ RSA *key = RSA_new();
+
+ if (n == NULL) {
+ fprintf(stderr, "Mandatory parameter n is NULL\n");
+ return 0L;
+ }
+ else {
+ nb = (*env)->GetByteArrayElements(env, n, 0);
+ key->n = BN_bin2bn(nb, nlen, NULL);
+ (*env)->ReleaseByteArrayElements(env, n, nb, 0);
+ }
+
+ if (e == NULL) {
+ fprintf(stderr, "Mandatory parameter e is NULL\n");
+ return 0L;
+ }
+ else {
+ eb = (*env)->GetByteArrayElements(env, e, 0);
+ key->e = BN_bin2bn(eb, elen, NULL);
+ (*env)->ReleaseByteArrayElements(env, e, eb, 0);
+ }
+
+ if (d != NULL) {
+ db = (*env)->GetByteArrayElements(env, d, 0);
+ key->d = BN_bin2bn(db, dlen, NULL);
+ (*env)->ReleaseByteArrayElements(env, d, db, 0);
+ }
+
+ if (p != NULL) {
+ pb = (*env)->GetByteArrayElements(env, p, 0);
+ key->p = BN_bin2bn(pb, plen, NULL);
+ (*env)->ReleaseByteArrayElements(env, p, pb, 0);
+ }
+
+ if (q != NULL) {
+ qb = (*env)->GetByteArrayElements(env, q, 0);
+ key->q = BN_bin2bn(qb, qlen, NULL);
+ (*env)->ReleaseByteArrayElements(env, q, qb, 0);
+ }
+
+ if (dmp1 != NULL) {
+ dmp1b = (*env)->GetByteArrayElements(env, dmp1, 0);
+ key->dmp1 = BN_bin2bn(dmp1b, dmp1len, NULL);
+ (*env)->ReleaseByteArrayElements(env, dmp1, dmp1b, 0);
+ }
+
+ if (dmq1 != NULL) {
+ dmq1b = (*env)->GetByteArrayElements(env, dmq1, 0);
+ key->dmq1 = BN_bin2bn(dmq1b, dmq1len, NULL);
+ (*env)->ReleaseByteArrayElements(env, dmq1, dmq1b, 0);
+ }
+
+ if (iqmp != NULL) {
+ iqmpb = (*env)->GetByteArrayElements(env, iqmp, 0);
+ key->iqmp = BN_bin2bn(iqmpb, iqmplen, NULL);
+ (*env)->ReleaseByteArrayElements(env, iqmp, iqmpb, 0);
+ }
+
+// if (d != NULL && RSA_check_key(key) > 0) {
+// printf("RSA private key OK for OpenSSL\n");
+// }
+
+ return (unsigned long)key;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: publicDecryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_publicDecryptOpenSSLRSA (JNIEnv *env, jclass jobj,
+ jint flen, jbyteArray from,
+ jbyteArray to, jlong handle, jint padding) {
+ jbyte *fromBytes, *toBytes;
+
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int RSAPadding = padding;
+ int ret;
+
+ fromBytes = (*env)->GetByteArrayElements(env, from, 0);
+ toBytes = (*env)->GetByteArrayElements(env, to, 0);
+
+ ret = RSA_public_decrypt(flen, fromBytes, toBytes, key, RSAPadding);
+
+ (*env)->ReleaseByteArrayElements(env, from, fromBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, to, toBytes, 0);
+ return ret;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: privateDecryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_privateDecryptOpenSSLRSA (JNIEnv *env, jclass jobj,
+ jint flen, jbyteArray from,
+ jbyteArray to, jlong handle, jint padding) {
+ jbyte *fromBytes, *toBytes;
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int RSAPadding = padding;
+ int ret;
+
+ fromBytes = (*env)->GetByteArrayElements(env, from, 0);
+ toBytes = (*env)->GetByteArrayElements(env, to, 0);
+
+ ret = RSA_private_decrypt(flen, fromBytes, toBytes, key, RSAPadding);
+
+ (*env)->ReleaseByteArrayElements(env, from, fromBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, to, toBytes, 0);
+ return ret;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: publicEncryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_publicEncryptOpenSSLRSA (JNIEnv *env, jclass jobj,
+ jint flen, jbyteArray from,
+ jbyteArray to, jlong handle, jint padding) {
+ jbyte *fromBytes, *toBytes;
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int RSAPadding = padding;
+ int ret;
+
+ fromBytes = (*env)->GetByteArrayElements(env, from, 0);
+ toBytes = (*env)->GetByteArrayElements(env, to, 0);
+
+ ret = RSA_public_encrypt(flen, fromBytes, toBytes, key, RSAPadding);
+
+ (*env)->ReleaseByteArrayElements(env, from, fromBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, to, toBytes, 0);
+ return ret;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: privateEncryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_privateEncryptOpenSSLRSA (JNIEnv *env, jclass jobj,
+ jint flen, jbyteArray from,
+ jbyteArray to, jlong handle, jint padding) {
+ jbyte *fromBytes, *toBytes;
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int RSAPadding = padding;
+ int ret;
+
+ fromBytes = (*env)->GetByteArrayElements(env, from, 0);
+ toBytes = (*env)->GetByteArrayElements(env, to, 0);
+
+ ret = RSA_private_encrypt(flen, fromBytes, toBytes, key, RSAPadding);
+
+ (*env)->ReleaseByteArrayElements(env, from, fromBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, to, toBytes, 0);
+ if(ret < 0) {
+ fprintf(stderr,"Encrypt private failed\n");
+ ERR_print_errors_fp(stderr);
+ }
+ return ret;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAsize
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAsize (JNIEnv *env, jclass jobj,
+ jlong handle) {
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ return RSA_size(key);
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAFree
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAFree (JNIEnv * env, jclass jobj,
+ jlong handle) {
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ RSA_free(key);
+ return;
+}
+
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSASign
+ * Signature: (I[BI[BJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSASign
+ (JNIEnv *env, jclass jobj, jint digestType, jbyteArray hash, jint hashlen, jbyteArray sig, jlong handle) {
+
+ jbyte *hashBytes, *sigBytes;
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int ret;
+ int len;
+
+ hashBytes = (*env)->GetByteArrayElements(env, hash, 0);
+ sigBytes = (*env)->GetByteArrayElements(env, sig, 0);
+
+ ret = RSA_sign(digestType, hashBytes, hashlen, sigBytes, &len, key);
+
+ (*env)->ReleaseByteArrayElements(env, hash, hashBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, sig, sigBytes, 0);
+
+ return ret;
+
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAVerify
+ * Signature: (I[BI[BIJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAVerify
+ (JNIEnv *env, jclass jobj, jint digestType, jbyteArray hash, jint hashlen, jbyteArray sig, jint siglen, jlong handle) {
+
+ jbyte *hashBytes, *sigBytes;
+#if SIZEOF_INT_P == 4
+ RSA *key = (RSA *)((int)(handle & 0xffffffff));
+#else
+ RSA *key = (RSA *)handle;
+#endif
+ int ret;
+
+ hashBytes = (*env)->GetByteArrayElements(env, hash, 0);
+ sigBytes = (*env)->GetByteArrayElements(env, sig, 0);
+
+ ret = RSA_verify(digestType, hashBytes, hashlen, sigBytes, siglen, key);
+
+ (*env)->ReleaseByteArrayElements(env, hash, hashBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, sig, sigBytes, 0);
+
+ return ret;
+}
Added: incubator/juice/native/src/JDKDSASignerOpenSSL.c
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/JDKDSASignerOpenSSL.c?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/JDKDSASignerOpenSSL.c (added)
+++ incubator/juice/native/src/JDKDSASignerOpenSSL.c Tue Feb 21 01:27:39 2006
@@ -0,0 +1,146 @@
+#include <stdio.h>
+#include <openssl/evp.h>
+#include <openssl/dsa.h>
+#include <openssl/bn.h>
+#include <jni.h>
+#include "org_apache_security_juice_provider_JDKDSASignerOpenSSL.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*
+ * Class: org_bouncycastle_jce_provider_JDKDSASignerOpenSSL
+ * Method: initOpenSSLDSA
+ * Signature: ([BI[BI[BI[BI[BI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_initOpenSSLDSA (JNIEnv *env, jclass jobj,
+ jbyteArray p, jint plen,
+ jbyteArray q, jint qlen,
+ jbyteArray g, jint glen,
+ jbyteArray x, jint xlen,
+ jbyteArray y, jint ylen) {
+
+ jbyte *pb, *qb, *gb, *xb, *yb;
+
+ DSA *key = DSA_new();
+
+ if (p == NULL) {
+ fprintf(stderr, "Mandatory parameter p is NULL\n");
+ return 0L;
+ }
+ else {
+ pb = (*env)->GetByteArrayElements(env, p, 0);
+ key->p = BN_bin2bn(pb, plen, NULL);
+ (*env)->ReleaseByteArrayElements(env, p, pb, 0);
+ }
+
+ if (q == NULL) {
+ fprintf(stderr, "Mandatory parameter q is NULL\n");
+ return 0L;
+ }
+ else {
+ qb = (*env)->GetByteArrayElements(env, q, 0);
+ key->q = BN_bin2bn(qb, qlen, NULL);
+ (*env)->ReleaseByteArrayElements(env, q, qb, 0);
+ }
+
+ if (g == NULL) {
+ fprintf(stderr, "Mandatory parameter g is NULL\n");
+ return 0L;
+ }
+ else {
+ gb = (*env)->GetByteArrayElements(env, g, 0);
+ key->g = BN_bin2bn(gb, glen, NULL);
+ (*env)->ReleaseByteArrayElements(env, g, gb, 0);
+ }
+
+ if (x == NULL && y == NULL) {
+ fprintf(stderr, "Public and private key parts are NULL\n");
+ return 0L;
+ }
+
+ // public key
+ if (y != NULL) {
+ yb = (*env)->GetByteArrayElements(env, y, 0);
+ key->pub_key = BN_bin2bn(yb, ylen, NULL);
+ (*env)->ReleaseByteArrayElements(env, y, yb, 0);
+ }
+
+ // private key
+ if (x != NULL) {
+ xb = (*env)->GetByteArrayElements(env, x, 0);
+ key->priv_key = BN_bin2bn(xb, xlen, NULL);
+ (*env)->ReleaseByteArrayElements(env, x, xb, 0);
+ }
+ return (unsigned long)key;
+}
+
+/*
+ * Class: org_bouncycastle_jce_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSASign
+ * Signature: ([BI[BJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSASign (JNIEnv *env, jclass jobj,
+ jbyteArray digest , jint diglen,
+ jbyteArray sign, jlong handle) {
+#if SIZEOF_INT_P == 4
+ DSA *key = (DSA *)((int)(handle & 0xffffffff));
+#else
+ DSA *key = (DSA *)handle;
+#endif
+ jbyte *digestBytes, *signBytes;
+ int ret, sigLen = 0;
+
+ digestBytes = (*env)->GetByteArrayElements(env, digest, 0);
+ signBytes = (*env)->GetByteArrayElements(env, sign, 0);
+
+ ret = DSA_sign(0, digestBytes, diglen, signBytes, &sigLen, key);
+
+ (*env)->ReleaseByteArrayElements(env, digest, digestBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, sign, signBytes, 0);
+ return sigLen;
+
+}
+
+/*
+ * Class: org_bouncycastle_jce_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSAVerify
+ * Signature: ([BI[BIJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSAVerify (JNIEnv *env, jclass jobj,
+ jbyteArray digest , jint diglen,
+ jbyteArray sign, jint sigLen, jlong handle) {
+#if SIZEOF_INT_P == 4
+ DSA *key = (DSA *)((int)(handle & 0xffffffff));
+#else
+ DSA *key = (DSA *)handle;
+#endif
+ jbyte *digestBytes, *signBytes;
+ int ret;
+
+ digestBytes = (*env)->GetByteArrayElements(env, digest, 0);
+ signBytes = (*env)->GetByteArrayElements(env, sign, 0);
+
+ ret = DSA_verify(0, digestBytes, diglen, signBytes, sigLen, key);
+
+ (*env)->ReleaseByteArrayElements(env, digest, digestBytes, 0);
+ (*env)->ReleaseByteArrayElements(env, sign, signBytes, 0);
+ return ret;
+}
+
+/*
+ * Class: org_bouncycastle_jce_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSASize
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSASize (JNIEnv *env, jclass jobj,
+ jlong handle) {
+#if SIZEOF_INT_P == 4
+ DSA *key = (DSA *)((int)(handle & 0xffffffff));
+#else
+ DSA *key = (DSA *)handle;
+#endif
+ return DSA_size(key);
+}
+
Added: incubator/juice/native/src/JDKMessageDigestOpenSSL.c
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/JDKMessageDigestOpenSSL.c?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/JDKMessageDigestOpenSSL.c (added)
+++ incubator/juice/native/src/JDKMessageDigestOpenSSL.c Tue Feb 21 01:27:39 2006
@@ -0,0 +1,164 @@
+#include <stdio.h>
+#include <openssl/evp.h>
+#include <jni.h>
+#include "org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestInit
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestInit
+(JNIEnv *env, jclass jobj, jstring digestName) {
+
+ const EVP_MD *digest;
+ EVP_MD_CTX *ctx;
+ int ret = 0;
+
+ const char *str = (*env)->GetStringUTFChars(env, digestName, 0);
+
+ digest = EVP_get_digestbyname(str);
+
+ if(!digest) {
+ fprintf(stderr,"Digest algorithm not found %s\n", str);
+ (*env)->ReleaseStringUTFChars(env, digestName, str);
+ return 0L;
+ }
+ (*env)->ReleaseStringUTFChars(env, digestName, str);
+
+ ctx = EVP_MD_CTX_create();
+ ret = EVP_DigestInit_ex(ctx, digest, NULL);
+ if(ret == 0) {
+ fprintf(stderr,"Digest initialization failed\n");
+ ERR_print_errors_fp(stderr);
+ EVP_MD_CTX_destroy(ctx);
+ return 0;
+ }
+ return (unsigned long)ctx;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestUpdate
+ * Signature: (J[BII)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestUpdate
+(JNIEnv * env, jclass jobj, jlong handle, jbyteArray data, jint offset, jint length) {
+
+ jbyte* inBytes;
+ int ret = 0;
+
+#if SIZEOF_INT_P == 4
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)handle;
+#endif
+
+ inBytes = (*env)->GetByteArrayElements(env, data, 0);
+ ret = EVP_DigestUpdate(ctx, inBytes+offset, length);
+ (*env)->ReleaseByteArrayElements(env, data, inBytes, 0);
+
+ if (ret == 0) {
+ fprintf(stderr,"Digesting bytes failed\n");
+ ERR_print_errors_fp(stderr);
+ return -1;
+ }
+ return length;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestFinal
+ * Signature: (J[B)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestFinal
+(JNIEnv * env, jclass jobj, jlong handle, jbyteArray hashOut) {
+
+ jbyte* outBytes;
+ int ret = 0;
+
+#if SIZEOF_INT_P == 4
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)handle;
+#endif
+
+ outBytes = (*env)->GetByteArrayElements(env, hashOut, 0);
+ ret = EVP_DigestFinal_ex(ctx, outBytes, NULL);
+ (*env)->ReleaseByteArrayElements(env, hashOut, outBytes, 0);
+ if (ret == 0) {
+ fprintf(stderr,"Finalizing bytes failed\n");
+ ERR_print_errors_fp(stderr);
+ return -1;
+ }
+ return EVP_MD_CTX_size(ctx);
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestDestroy
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestDestroy
+(JNIEnv * env, jclass jobj, jlong handle) {
+
+#if SIZEOF_INT_P == 4
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)handle;
+#endif
+ EVP_MD_CTX_destroy(ctx);
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestCopy
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestCopy
+(JNIEnv * env, jclass jobj, jlong handle) {
+
+#if SIZEOF_INT_P == 4
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)handle;
+#endif
+ int ret = 0;
+
+ EVP_MD_CTX *ctxNew = EVP_MD_CTX_create();
+ if (!EVP_DigestInit_ex(ctxNew, EVP_MD_CTX_md(ctx), NULL)) {
+ fprintf(stderr,"DigestInit for copy failed\n");
+ ERR_print_errors_fp(stderr);
+ EVP_MD_CTX_destroy(ctxNew);
+ return 0;
+ }
+
+ if (!EVP_MD_CTX_copy_ex(ctxNew, ctx)) {
+ fprintf(stderr,"Digest copy failed\n");
+ ERR_print_errors_fp(stderr);
+ EVP_MD_CTX_destroy(ctxNew);
+ return 0;
+ }
+ return (long)ctx;
+}
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestGetType
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestGetType
+(JNIEnv *env, jclass jobj, jlong handle) {
+
+#if SIZEOF_INT_P == 4
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)((int)(handle & 0xffffffff));
+#else
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)handle;
+#endif
+ return EVP_MD_CTX_type(ctx);
+}
+
Modified: incubator/juice/native/src/Makefile.am
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/Makefile.am?rev=379398&r1=379397&r2=379398&view=diff
==============================================================================
--- incubator/juice/native/src/Makefile.am (original)
+++ incubator/juice/native/src/Makefile.am Tue Feb 21 01:27:39 2006
@@ -1,19 +1,22 @@
-## $Id: Makefile.am,v 1.1 2004/01/14 04:59:14 nlevitt Exp $
+# AM_CPPFLAGS = @JNI_CPPFLAGS@
-AM_CPPFLAGS = @JNI_CPPFLAGS@
-
-lib_LTLIBRARIES = libjuice.la
-libjuice_la_LIBADD = @CRYPTO_LIBS@
+lib_LTLIBRARIES = libopenSSL4Java.la
+# libopenSSL4Java_la_LIBADD = @CRYPTO_LIBS@
# http://www.gnu.org/software/libtool/manual.html#Versioning
-libjuice_la_LDFLAGS = -version-info 0:0:0
+libopenSSL4Java_la_LDFLAGS = -version-info 0:0:0
+
+include_HEADERS = org_apache_security_juice_provider_InitializeOpenSSL.h \
+ org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h \
+ org_apache_security_juice_provider_JCERSACipherOpenSSL.h \
+ org_apache_security_juice_provider_JDKDSASignerOpenSSL.h \
+ org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h
+
+libopenSSL4Java_la_SOURCES = InitializeOpenSSL.c \
+ JCEBlockCipherOpenSSL.c \
+ JCERSACipherOpenSSL.c \
+ JDKDSASignerOpenSSL.c \
+ JDKMessageDigestOpenSSL.c
-libjuice_la_SOURCES = juice.h \
- md5.c \
- rsa.c \
- sha-1.c \
- digest.h \
- random.c \
- digest.c
Added: incubator/juice/native/src/openSSL4Java.sh
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/openSSL4Java.sh?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/openSSL4Java.sh (added)
+++ incubator/juice/native/src/openSSL4Java.sh Tue Feb 21 01:27:39 2006
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Shared library for openSSL libcrypto Java binding
+
+# Java runs in the 32 bit environment. Set gcc to use
+# the appropriate flag.
+GCC="gcc -m32"
+
+# Create shared library's object files
+
+libtool --mode=compile $GCC -O -c JCEBlockCipherOpenSSL.c
+libtool --mode=compile $GCC -O -c JCERSACipherOpenSSL.c
+libtool --mode=compile $GCC -O -c JDKMessageDigestOpenSSL.c
+libtool --mode=compile $GCC -O -c JDKDSASignerOpenSSL.c
+libtool --mode=compile $GCC -O -c InitializeOpenSSL.c
+
+# Create shared library.
+# Use -lcrypto to link it against openSSL crypto library
+
+libtool --mode=link $GCC -O -o libopenSSL4Java.la JCEBlockCipherOpenSSL.lo \
+ JCERSACipherOpenSSL.lo \
+ JDKMessageDigestOpenSSL.lo \
+ JDKDSASignerOpenSSL.lo \
+ InitializeOpenSSL.lo \
+ -rpath /usr/local/lib -lcrypto
+
Added: incubator/juice/native/src/org_apache_security_juice_provider_InitializeOpenSSL.h
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/org_apache_security_juice_provider_InitializeOpenSSL.h?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/org_apache_security_juice_provider_InitializeOpenSSL.h (added)
+++ incubator/juice/native/src/org_apache_security_juice_provider_InitializeOpenSSL.h Tue Feb 21 01:27:39 2006
@@ -0,0 +1,32 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_apache_security_juice_provider_InitializeOpenSSL */
+
+#ifndef _Included_org_apache_security_juice_provider_InitializeOpenSSL
+#define _Included_org_apache_security_juice_provider_InitializeOpenSSL
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Inaccessible static: ios */
+/* Inaccessible static: notFailed */
+/* Inaccessible static: synchObject */
+/*
+ * Class: org_apache_security_juice_provider_InitializeOpenSSL
+ * Method: getNumLocks
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_InitializeOpenSSL_getNumLocks
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_apache_security_juice_provider_InitializeOpenSSL
+ * Method: initializeOpenSSL
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_InitializeOpenSSL_initializeOpenSSL
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: incubator/juice/native/src/org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h (added)
+++ incubator/juice/native/src/org_apache_security_juice_provider_JCEBlockCipherOpenSSL.h Tue Feb 21 01:27:39 2006
@@ -0,0 +1,51 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_apache_security_juice_provider_JCEBlockCipherOpenSSL */
+
+#ifndef _Included_org_apache_security_juice_provider_JCEBlockCipherOpenSSL
+#define _Included_org_apache_security_juice_provider_JCEBlockCipherOpenSSL
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_apache_security_juice_provider_JCEBlockCipherOpenSSL_NOPAD
+#define org_apache_security_juice_provider_JCEBlockCipherOpenSSL_NOPAD 0L
+#undef org_apache_security_juice_provider_JCEBlockCipherOpenSSL_PKCS7
+#define org_apache_security_juice_provider_JCEBlockCipherOpenSSL_PKCS7 1L
+#undef org_apache_security_juice_provider_JCEBlockCipherOpenSSL_ISO10126
+#define org_apache_security_juice_provider_JCEBlockCipherOpenSSL_ISO10126 2L
+#undef org_apache_security_juice_provider_JCEBlockCipherOpenSSL_DES_BLOCKSIZE
+#define org_apache_security_juice_provider_JCEBlockCipherOpenSSL_DES_BLOCKSIZE 8L
+#undef org_apache_security_juice_provider_JCEBlockCipherOpenSSL_AES_BLOCKSIZE
+#define org_apache_security_juice_provider_JCEBlockCipherOpenSSL_AES_BLOCKSIZE 16L
+/* Inaccessible static: class_000240 */
+/* Inaccessible static: class_000241 */
+/* Inaccessible static: class_000242 */
+/* Inaccessible static: class_000243 */
+/*
+ * Class: org_apache_security_juice_provider_JCEBlockCipherOpenSSL
+ * Method: initOpenSSLEvp
+ * Signature: (Ljava/lang/String;Z[BI[BII)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_initOpenSSLEvp
+ (JNIEnv *, jobject, jstring, jboolean, jbyteArray, jint, jbyteArray, jint, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCEBlockCipherOpenSSL
+ * Method: processBytesOpenSSL
+ * Signature: (J[BII[BI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_processBytesOpenSSL
+ (JNIEnv *, jobject, jlong, jbyteArray, jint, jint, jbyteArray, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCEBlockCipherOpenSSL
+ * Method: doFinalOpenSSL
+ * Signature: (J[BII)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCEBlockCipherOpenSSL_doFinalOpenSSL
+ (JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: incubator/juice/native/src/org_apache_security_juice_provider_JCERSACipherOpenSSL.h
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/org_apache_security_juice_provider_JCERSACipherOpenSSL.h?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/org_apache_security_juice_provider_JCERSACipherOpenSSL.h (added)
+++ incubator/juice/native/src/org_apache_security_juice_provider_JCERSACipherOpenSSL.h Tue Feb 21 01:27:39 2006
@@ -0,0 +1,95 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_apache_security_juice_provider_JCERSACipherOpenSSL */
+
+#ifndef _Included_org_apache_security_juice_provider_JCERSACipherOpenSSL
+#define _Included_org_apache_security_juice_provider_JCERSACipherOpenSSL
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_PKCS1_PADDING
+#define org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_PKCS1_PADDING 1L
+#undef org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_NO_PADDING
+#define org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_NO_PADDING 3L
+#undef org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_PKCS1_OAEP_PADDING
+#define org_apache_security_juice_provider_JCERSACipherOpenSSL_RSA_PKCS1_OAEP_PADDING 4L
+#undef org_apache_security_juice_provider_JCERSACipherOpenSSL_PKCS1_PADDING_SIZE
+#define org_apache_security_juice_provider_JCERSACipherOpenSSL_PKCS1_PADDING_SIZE 11L
+#undef org_apache_security_juice_provider_JCERSACipherOpenSSL_PKCS1_OAEP_PADDING_SIZE
+#define org_apache_security_juice_provider_JCERSACipherOpenSSL_PKCS1_OAEP_PADDING_SIZE 41L
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: initOpenSSLRSA
+ * Signature: ([BI[BI[BI[BI[BI[BI[BI[BI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_initOpenSSLRSA
+ (JNIEnv *, jclass, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: publicDecryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_publicDecryptOpenSSLRSA
+ (JNIEnv *, jclass, jint, jbyteArray, jbyteArray, jlong, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: privateDecryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_privateDecryptOpenSSLRSA
+ (JNIEnv *, jclass, jint, jbyteArray, jbyteArray, jlong, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: publicEncryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_publicEncryptOpenSSLRSA
+ (JNIEnv *, jclass, jint, jbyteArray, jbyteArray, jlong, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: privateEncryptOpenSSLRSA
+ * Signature: (I[B[BJI)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_privateEncryptOpenSSLRSA
+ (JNIEnv *, jclass, jint, jbyteArray, jbyteArray, jlong, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAsize
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAsize
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAFree
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAFree
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSASign
+ * Signature: (I[BI[BJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSASign
+ (JNIEnv *, jclass, jint, jbyteArray, jint, jbyteArray, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JCERSACipherOpenSSL
+ * Method: openSSLRSAVerify
+ * Signature: (I[BI[BIJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JCERSACipherOpenSSL_openSSLRSAVerify
+ (JNIEnv *, jclass, jint, jbyteArray, jint, jbyteArray, jint, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: incubator/juice/native/src/org_apache_security_juice_provider_JDKDSASignerOpenSSL.h
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/org_apache_security_juice_provider_JDKDSASignerOpenSSL.h?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/org_apache_security_juice_provider_JDKDSASignerOpenSSL.h (added)
+++ incubator/juice/native/src/org_apache_security_juice_provider_JDKDSASignerOpenSSL.h Tue Feb 21 01:27:39 2006
@@ -0,0 +1,57 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_apache_security_juice_provider_JDKDSASignerOpenSSL */
+
+#ifndef _Included_org_apache_security_juice_provider_JDKDSASignerOpenSSL
+#define _Included_org_apache_security_juice_provider_JDKDSASignerOpenSSL
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_debug
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_debug 0L
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_UNINITIALIZED
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_UNINITIALIZED 0L
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_SIGN
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_SIGN 2L
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_VERIFY
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_VERIFY 3L
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_DSA_SIGNER
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_DSA_SIGNER 1L
+#undef org_apache_security_juice_provider_JDKDSASignerOpenSSL_ECDSA_SIGNER
+#define org_apache_security_juice_provider_JDKDSASignerOpenSSL_ECDSA_SIGNER 2L
+/*
+ * Class: org_apache_security_juice_provider_JDKDSASignerOpenSSL
+ * Method: initOpenSSLDSA
+ * Signature: ([BI[BI[BI[BI[BI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_initOpenSSLDSA
+ (JNIEnv *, jclass, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint, jbyteArray, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSASize
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSASize
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSASign
+ * Signature: ([BI[BJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSASign
+ (JNIEnv *, jclass, jbyteArray, jint, jbyteArray, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKDSASignerOpenSSL
+ * Method: openSSLDSAVerify
+ * Signature: ([BI[BIJ)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKDSASignerOpenSSL_openSSLDSAVerify
+ (JNIEnv *, jclass, jbyteArray, jint, jbyteArray, jint, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: incubator/juice/native/src/org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h
URL: http://svn.apache.org/viewcvs/incubator/juice/native/src/org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h?rev=379398&view=auto
==============================================================================
--- incubator/juice/native/src/org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h (added)
+++ incubator/juice/native/src/org_apache_security_juice_provider_JDKMessageDigestOpenSSL.h Tue Feb 21 01:27:39 2006
@@ -0,0 +1,65 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_apache_security_juice_provider_JDKMessageDigestOpenSSL */
+
+#ifndef _Included_org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+#define _Included_org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_apache_security_juice_provider_JDKMessageDigestOpenSSL_INITIAL
+#define org_apache_security_juice_provider_JDKMessageDigestOpenSSL_INITIAL 0L
+#undef org_apache_security_juice_provider_JDKMessageDigestOpenSSL_IN_PROGRESS
+#define org_apache_security_juice_provider_JDKMessageDigestOpenSSL_IN_PROGRESS 1L
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestInit
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestInit
+ (JNIEnv *, jclass, jstring);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestUpdate
+ * Signature: (J[BII)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestUpdate
+ (JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestFinal
+ * Signature: (J[B)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestFinal
+ (JNIEnv *, jclass, jlong, jbyteArray);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestDestroy
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestDestroy
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestCopy
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestCopy
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_apache_security_juice_provider_JDKMessageDigestOpenSSL
+ * Method: openSSLDigestGetType
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_security_juice_provider_JDKMessageDigestOpenSSL_openSSLDigestGetType
+ (JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: juice-svn-unsubscribe@xml.apache.org
For additional commands, e-mail: juice-svn-help@xml.apache.org