|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/build_java.pl.cfuOrig jss-4.2.6/mozilla/security/jss/build_java.pl
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/build_java.pl.cfuOrig 2012-03-19 17:48:57.615048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/build_java.pl 2012-03-19 17:48:53.250052000 -0700
|
|
|
b93447 |
@@ -19,6 +19,7 @@ org.mozilla.jss.crypto.Algorithm
|
|
|
b93447 |
org.mozilla.jss.crypto.EncryptionAlgorithm
|
|
|
b93447 |
org.mozilla.jss.crypto.PQGParams
|
|
|
b93447 |
org.mozilla.jss.crypto.SecretDecoderRing
|
|
|
b93447 |
+org.mozilla.jss.asn1.ASN1Util
|
|
|
b93447 |
org.mozilla.jss.pkcs11.CertProxy
|
|
|
b93447 |
org.mozilla.jss.pkcs11.CipherContextProxy
|
|
|
b93447 |
org.mozilla.jss.pkcs11.PK11Module
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/lib/config.mk.cfuOrig jss-4.2.6/mozilla/security/jss/lib/config.mk
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/lib/config.mk.cfuOrig 2012-03-19 17:48:57.535048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/lib/config.mk 2012-03-19 17:48:53.264052000 -0700
|
|
|
b93447 |
@@ -44,6 +44,7 @@ SHARED_LIBRARY_DIRS = \
|
|
|
b93447 |
../org/mozilla/jss/SecretDecoderRing \
|
|
|
b93447 |
../org/mozilla/jss \
|
|
|
b93447 |
../org/mozilla/jss/pkcs11 \
|
|
|
b93447 |
+ ../org/mozilla/jss/asn1 \
|
|
|
b93447 |
../org/mozilla/jss/ssl \
|
|
|
b93447 |
../org/mozilla/jss/util \
|
|
|
b93447 |
../org/mozilla/jss/provider/java/security \
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/lib/jss.def.cfuOrig jss-4.2.6/mozilla/security/jss/lib/jss.def
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/lib/jss.def.cfuOrig 2012-03-19 17:48:57.362048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/lib/jss.def 2012-03-19 17:48:53.278052000 -0700
|
|
|
b93447 |
@@ -333,6 +333,7 @@ Java_org_mozilla_jss_CryptoManager_OCSPC
|
|
|
b93447 |
Java_org_mozilla_jss_CryptoManager_setOCSPTimeoutNative;
|
|
|
b93447 |
Java_org_mozilla_jss_CryptoManager_verifyCertificateNowNative;
|
|
|
b93447 |
Java_org_mozilla_jss_CryptoManager_verifyCertificateNowCUNative;
|
|
|
b93447 |
+Java_org_mozilla_jss_asn1_ASN1Util_getTagDescriptionByOid;
|
|
|
b93447 |
;+ local:
|
|
|
b93447 |
;+ *;
|
|
|
b93447 |
;+};
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/lib/rules.mk.cfuOrig jss-4.2.6/mozilla/security/jss/lib/rules.mk
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/lib/rules.mk.cfuOrig 2012-03-19 17:48:57.574049000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/lib/rules.mk 2012-03-19 17:48:53.288052000 -0700
|
|
|
b93447 |
@@ -41,6 +41,7 @@ release_sanitize::
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jsscrypto$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jssmanage$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jsspkcs11$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
+ -rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jssasn1$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jsspolicy$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jssssl$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(DLL_PREFIX)jssutil$(DYNAMIC_LIB_EXTENSION)$(DYNAMIC_LIB_SUFFIX)
|
|
|
b93447 |
@@ -48,6 +49,7 @@ ifeq ($(OS_ARCH),WINNT)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jsscrypto$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jssmanage$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jsspkcs11$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
+ -rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jssasn1$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jsspolicy$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jssssl$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
-rm $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)/$(IMPORT_LIB_PREFIX)jssutil$(IMPORT_LIB_EXTENSION)$(IMPORT_LIB_SUFFIX)
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.c.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.c
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.c.cfuOrig 2012-03-19 17:48:57.381048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.c 2012-03-19 17:51:32.433893000 -0700
|
|
|
b93447 |
@@ -0,0 +1,97 @@
|
|
|
b93447 |
+/* ***** BEGIN LICENSE BLOCK *****
|
|
|
b93447 |
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * The contents of this file are subject to the Mozilla Public License Version
|
|
|
b93447 |
+ * 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
b93447 |
+ * the License. You may obtain a copy of the License at
|
|
|
b93447 |
+ * http://www.mozilla.org/MPL/
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
b93447 |
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
b93447 |
+ * for the specific language governing rights and limitations under the
|
|
|
b93447 |
+ * License.
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * The Original Code is the Netscape Security Services for Java.
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * The Initial Developer of the Original Code is
|
|
|
b93447 |
+ * Netscape Communications Corporation.
|
|
|
b93447 |
+ * Portions created by the Initial Developer are Copyright (C) 1998-2000
|
|
|
b93447 |
+ * the Initial Developer. All Rights Reserved.
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * Contributor(s):
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * Alternatively, the contents of this file may be used under the terms of
|
|
|
b93447 |
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
b93447 |
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
b93447 |
+ * in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
b93447 |
+ * of those above. If you wish to allow use of your version of this file only
|
|
|
b93447 |
+ * under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
b93447 |
+ * use your version of this file under the terms of the MPL, indicate your
|
|
|
b93447 |
+ * decision by deleting the provisions above and replace them with the notice
|
|
|
b93447 |
+ * and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
b93447 |
+ * the provisions above, a recipient may use your version of this file under
|
|
|
b93447 |
+ * the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * ***** END LICENSE BLOCK ***** */
|
|
|
b93447 |
+#include "_jni/org_mozilla_jss_asn1_ASN1Util.h"
|
|
|
b93447 |
+#include <pk11func.h>
|
|
|
b93447 |
+#include <nspr.h>
|
|
|
b93447 |
+#include <seccomon.h>
|
|
|
b93447 |
+#include <key.h>
|
|
|
b93447 |
+#include <secitem.h>
|
|
|
b93447 |
+
|
|
|
b93447 |
+#include <jssutil.h>
|
|
|
b93447 |
+#include <java_ids.h>
|
|
|
b93447 |
+#include <jss_exceptions.h>
|
|
|
b93447 |
+#include <Algorithm.h>
|
|
|
b93447 |
+
|
|
|
b93447 |
+/***********************************************************************
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * Java_org_mozilla_jss_asn1_ASN1Util_getTagDescriptionByOid
|
|
|
b93447 |
+ * retrieves OID description by NSS's OID Tag identifier
|
|
|
b93447 |
+ * the OID byte array is expected to be without the OID Tag (6) and size
|
|
|
b93447 |
+ * (together 2 bytes)
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+JNIEXPORT jstring JNICALL
|
|
|
b93447 |
+Java_org_mozilla_jss_asn1_ASN1Util_getTagDescriptionByOid(JNIEnv *env, jobject this, jbyteArray oidBA)
|
|
|
b93447 |
+{
|
|
|
b93447 |
+ SECItem *oid = NULL;
|
|
|
b93447 |
+ SECOidTag oidTag = SEC_OID_UNKNOWN;
|
|
|
b93447 |
+ char *oidDesc = NULL;
|
|
|
b93447 |
+ jstring description= "";
|
|
|
b93447 |
+
|
|
|
b93447 |
+ if (oidBA == NULL) {
|
|
|
b93447 |
+ JSS_throwMsg(env, INVALID_PARAMETER_EXCEPTION,
|
|
|
b93447 |
+ "JSS getTagDescriptionByOid: oidBA null");
|
|
|
b93447 |
+ goto finish;
|
|
|
b93447 |
+ } else {
|
|
|
b93447 |
+ /**************************************************
|
|
|
b93447 |
+ * Setup the parameters
|
|
|
b93447 |
+ *************************************************/
|
|
|
b93447 |
+ oid = JSS_ByteArrayToSECItem(env, oidBA);
|
|
|
b93447 |
+ if (oid == NULL) {
|
|
|
b93447 |
+ JSS_throwMsg(env, INVALID_PARAMETER_EXCEPTION,
|
|
|
b93447 |
+ "JSS getTagDescriptionByOid: JSS_ByteArrayToSECItem failed");
|
|
|
b93447 |
+ goto finish;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /*
|
|
|
b93447 |
+ * SECOID_FindOIDTag() returns SEC_OID_UNKNOWN if no match
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+ oidTag = SECOID_FindOIDTag(oid);
|
|
|
b93447 |
+ if (oidTag == SEC_OID_UNKNOWN) {
|
|
|
b93447 |
+ JSS_throwMsg(env, INVALID_PARAMETER_EXCEPTION,
|
|
|
b93447 |
+ "JSS getTagDescriptionByOid: OID UNKNOWN");
|
|
|
b93447 |
+ goto finish;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ oidDesc = SECOID_FindOIDTagDescription(oidTag);
|
|
|
b93447 |
+ if (oidDesc == NULL) {
|
|
|
b93447 |
+ oidDesc = "";
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ description = (*env)->NewStringUTF(env, oidDesc);
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+finish:
|
|
|
b93447 |
+ return description;
|
|
|
b93447 |
+}
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.java.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.java
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.java.cfuOrig 2012-03-19 17:48:57.119048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/ASN1Util.java 2012-03-19 18:03:20.766186000 -0700
|
|
|
b93447 |
@@ -36,6 +36,8 @@
|
|
|
b93447 |
package org.mozilla.jss.asn1;
|
|
|
b93447 |
|
|
|
b93447 |
import java.io.*;
|
|
|
b93447 |
+import java.util.Arrays;
|
|
|
b93447 |
+
|
|
|
b93447 |
import org.mozilla.jss.asn1.InvalidBERException;
|
|
|
b93447 |
import org.mozilla.jss.util.Assert;
|
|
|
b93447 |
|
|
|
b93447 |
@@ -114,4 +116,71 @@ public class ASN1Util {
|
|
|
b93447 |
numRead += nr;
|
|
|
b93447 |
}
|
|
|
b93447 |
}
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /**
|
|
|
b93447 |
+ * returns the ECC curve byte array given the X509 public key byte array
|
|
|
b93447 |
+ *
|
|
|
b93447 |
+ * @param X509PubKeyBytes byte array of an X509PubKey
|
|
|
b93447 |
+ * @param withHeader tells if the return byes should inclulde the tag and size header or not
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+ public static byte[] getECCurveBytesByX509PublicKeyBytes(byte[] X509PubKeyBytes,
|
|
|
b93447 |
+ boolean withHeader)
|
|
|
b93447 |
+ throws IllegalArgumentException, ArrayIndexOutOfBoundsException,
|
|
|
b93447 |
+ NullPointerException
|
|
|
b93447 |
+ {
|
|
|
b93447 |
+ if ((X509PubKeyBytes == null) || (X509PubKeyBytes.length == 0)) {
|
|
|
b93447 |
+ throw new IllegalArgumentException("X509PubKeyBytes null");
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /* EC public key OID complete with tag and size */
|
|
|
b93447 |
+ byte[] EC_PubOIDBytes_full =
|
|
|
b93447 |
+ ASN1Util.encode(OBJECT_IDENTIFIER.EC_PUBKEY_OID);
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /* EC public key OID without tag and size */
|
|
|
b93447 |
+ byte[] EC_PubOIDBytes =
|
|
|
b93447 |
+ Arrays.copyOfRange(EC_PubOIDBytes_full, 2, EC_PubOIDBytes_full.length);
|
|
|
b93447 |
+
|
|
|
b93447 |
+ int curveBeginIndex = 0;
|
|
|
b93447 |
+ for (int idx = 0; idx<= X509PubKeyBytes.length; idx++) {
|
|
|
b93447 |
+ byte[] tmp =
|
|
|
b93447 |
+ Arrays.copyOfRange(X509PubKeyBytes, idx, idx+EC_PubOIDBytes.length);
|
|
|
b93447 |
+ if (Arrays.equals(tmp, EC_PubOIDBytes)) {
|
|
|
b93447 |
+ curveBeginIndex = idx+ EC_PubOIDBytes.length;
|
|
|
b93447 |
+ break;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ int curveByteArraySize = (int) X509PubKeyBytes[curveBeginIndex+ 1];
|
|
|
b93447 |
+
|
|
|
b93447 |
+ if (withHeader) {
|
|
|
b93447 |
+ /* actual curve with tag and size */
|
|
|
b93447 |
+ byte curve[] = Arrays.copyOfRange(X509PubKeyBytes, curveBeginIndex, curveBeginIndex + curveByteArraySize + 2);
|
|
|
b93447 |
+ return curve;
|
|
|
b93447 |
+ } else {
|
|
|
b93447 |
+ /* actual curve without tag and size */
|
|
|
b93447 |
+ byte curve[] =
|
|
|
b93447 |
+ Arrays.copyOfRange(X509PubKeyBytes, curveBeginIndex + 2,
|
|
|
b93447 |
+ curveBeginIndex + 2 + curveByteArraySize);
|
|
|
b93447 |
+ return curve;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /**
|
|
|
b93447 |
+ * getOIDdescription() returns a text description of the OID
|
|
|
b93447 |
+ * from OID byte array
|
|
|
b93447 |
+ * the OID byte array is expected to be without the OID Tag (6) and size
|
|
|
b93447 |
+ * (together 2 bytes)
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+ public static String
|
|
|
b93447 |
+ getOIDdescription(byte[] oidBA) {
|
|
|
b93447 |
+ return getTagDescriptionByOid(oidBA);
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /**
|
|
|
b93447 |
+ * get OID description JNI method
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+ private native static String
|
|
|
b93447 |
+ getTagDescriptionByOid(byte[] oidBA);
|
|
|
b93447 |
+
|
|
|
b93447 |
+
|
|
|
b93447 |
}
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/Makefile.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/Makefile
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/Makefile.cfuOrig 2012-03-19 17:48:57.467048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/Makefile 2012-03-19 17:48:53.348052000 -0700
|
|
|
b93447 |
@@ -57,7 +57,7 @@ include $(CORE_DEPTH)/$(MODULE)/config/c
|
|
|
b93447 |
#######################################################################
|
|
|
b93447 |
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
|
|
|
b93447 |
#######################################################################
|
|
|
b93447 |
-#include config.mk
|
|
|
b93447 |
+include config.mk
|
|
|
b93447 |
|
|
|
b93447 |
|
|
|
b93447 |
#######################################################################
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/OBJECT_IDENTIFIER.java.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/OBJECT_IDENTIFIER.java
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/OBJECT_IDENTIFIER.java.cfuOrig 2012-03-19 17:48:57.178048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/OBJECT_IDENTIFIER.java 2012-03-19 17:48:53.364052000 -0700
|
|
|
b93447 |
@@ -52,6 +52,12 @@ public class OBJECT_IDENTIFIER implement
|
|
|
b93447 |
///////////////////////////////////////////////////////////////////////
|
|
|
b93447 |
|
|
|
b93447 |
/**
|
|
|
b93447 |
+ * The OID space for EC
|
|
|
b93447 |
+ */
|
|
|
b93447 |
+ public static final OBJECT_IDENTIFIER EC_PUBKEY_OID =
|
|
|
b93447 |
+ new OBJECT_IDENTIFIER( new long[]{1, 2, 840, 10045, 2, 1} );
|
|
|
b93447 |
+
|
|
|
b93447 |
+ /**
|
|
|
b93447 |
* The OID space for RSA Data Security, Inc.
|
|
|
b93447 |
*/
|
|
|
b93447 |
public static final OBJECT_IDENTIFIER RSADSI =
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/config.mk.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/config.mk
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/config.mk.cfuOrig 2012-03-19 17:48:57.398048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/config.mk 2012-03-19 17:48:53.381052000 -0700
|
|
|
b93447 |
@@ -0,0 +1,41 @@
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# ***** BEGIN LICENSE BLOCK *****
|
|
|
b93447 |
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# The contents of this file are subject to the Mozilla Public License Version
|
|
|
b93447 |
+# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
b93447 |
+# the License. You may obtain a copy of the License at
|
|
|
b93447 |
+# http://www.mozilla.org/MPL/
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
b93447 |
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
b93447 |
+# for the specific language governing rights and limitations under the
|
|
|
b93447 |
+# License.
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# The Original Code is the Netscape Security Services for Java.
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# The Initial Developer of the Original Code is
|
|
|
b93447 |
+# Netscape Communications Corporation.
|
|
|
b93447 |
+# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
|
|
b93447 |
+# the Initial Developer. All Rights Reserved.
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# Contributor(s):
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# Alternatively, the contents of this file may be used under the terms of
|
|
|
b93447 |
+# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
b93447 |
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
b93447 |
+# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
b93447 |
+# of those above. If you wish to allow use of your version of this file only
|
|
|
b93447 |
+# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
b93447 |
+# use your version of this file under the terms of the MPL, indicate your
|
|
|
b93447 |
+# decision by deleting the provisions above and replace them with the notice
|
|
|
b93447 |
+# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
b93447 |
+# the provisions above, a recipient may use your version of this file under
|
|
|
b93447 |
+# the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
b93447 |
+#
|
|
|
b93447 |
+# ***** END LICENSE BLOCK *****
|
|
|
b93447 |
+TARGETS=$(LIBRARY)
|
|
|
b93447 |
+SHARED_LIBRARY=
|
|
|
b93447 |
+IMPORT_LIBRARY=
|
|
|
b93447 |
+
|
|
|
b93447 |
+NO_MD_RELEASE = 1
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/manifest.mn.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/manifest.mn
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/manifest.mn.cfuOrig 2012-03-19 17:48:57.434048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/asn1/manifest.mn 2012-03-19 17:48:53.401052000 -0700
|
|
|
b93447 |
@@ -41,6 +41,8 @@ MODULE = jss
|
|
|
b93447 |
|
|
|
b93447 |
NS_USE_JDK = 1
|
|
|
b93447 |
|
|
|
b93447 |
+REQUIRES = nspr20 nss
|
|
|
b93447 |
+
|
|
|
b93447 |
PACKAGE = org/mozilla/jss/asn1
|
|
|
b93447 |
|
|
|
b93447 |
CLASSES = \
|
|
|
b93447 |
@@ -112,3 +114,9 @@ JSRCS = \
|
|
|
b93447 |
UTCTime.java \
|
|
|
b93447 |
UTF8String.java \
|
|
|
b93447 |
$(NULL)
|
|
|
b93447 |
+
|
|
|
b93447 |
+CSRCS = \
|
|
|
b93447 |
+ ASN1Util.c \
|
|
|
b93447 |
+ $(NULL)
|
|
|
b93447 |
+
|
|
|
b93447 |
+LIBRARY_NAME = jssasn1
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/manifest.mn.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/manifest.mn
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/manifest.mn.cfuOrig 2012-03-19 17:48:57.502048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/manifest.mn 2012-03-19 17:48:53.413052000 -0700
|
|
|
b93447 |
@@ -48,6 +48,7 @@ DIRS = \
|
|
|
b93447 |
crypto \
|
|
|
b93447 |
SecretDecoderRing \
|
|
|
b93447 |
pkcs11 \
|
|
|
b93447 |
+ asn1 \
|
|
|
b93447 |
ssl \
|
|
|
b93447 |
provider \
|
|
|
b93447 |
$(NULL)
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11ECPublicKey.java.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11ECPublicKey.java
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11ECPublicKey.java.cfuOrig 2012-03-19 17:48:57.238048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11ECPublicKey.java 2012-03-19 17:48:53.432052000 -0700
|
|
|
b93447 |
@@ -61,15 +61,29 @@ public final class PK11ECPublicKey exten
|
|
|
b93447 |
// }
|
|
|
b93447 |
// }
|
|
|
b93447 |
//
|
|
|
b93447 |
-// public BigInteger getW() {
|
|
|
b93447 |
-// try {
|
|
|
b93447 |
-// return new BigInteger( getWByteArray() );
|
|
|
b93447 |
-// } catch(NumberFormatException e) {
|
|
|
b93447 |
-// Assert.notReached("Unable to decode DSA public value");
|
|
|
b93447 |
-// return null;
|
|
|
b93447 |
-// }
|
|
|
b93447 |
-// }
|
|
|
b93447 |
-//
|
|
|
b93447 |
-// private native byte[] getCurveByteArray();
|
|
|
b93447 |
-// private native byte[] getWByteArray();
|
|
|
b93447 |
+
|
|
|
b93447 |
+ public BigInteger getCurve() {
|
|
|
b93447 |
+ try {
|
|
|
b93447 |
+ return new BigInteger( getCurveByteArray() );
|
|
|
b93447 |
+ } catch(NumberFormatException e) {
|
|
|
b93447 |
+ Assert.notReached("Unable to decode EC curve");
|
|
|
b93447 |
+ return null;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ public byte[] getCurveBA() {
|
|
|
b93447 |
+ return getCurveByteArray();
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ public BigInteger getW() {
|
|
|
b93447 |
+ try {
|
|
|
b93447 |
+ return new BigInteger( getWByteArray() );
|
|
|
b93447 |
+ } catch(NumberFormatException e) {
|
|
|
b93447 |
+ Assert.notReached("Unable to decode EC public value");
|
|
|
b93447 |
+ return null;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+
|
|
|
b93447 |
+ private native byte[] getCurveByteArray();
|
|
|
b93447 |
+ private native byte[] getWByteArray();
|
|
|
b93447 |
}
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c.cfuOrig 2012-03-19 17:48:57.272048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.c 2012-03-19 17:48:53.450052000 -0700
|
|
|
b93447 |
@@ -450,6 +450,14 @@ Java_org_mozilla_jss_pkcs11_PK11KeyWrapp
|
|
|
b93447 |
numAttribs = 4;
|
|
|
b93447 |
}
|
|
|
b93447 |
break;
|
|
|
b93447 |
+ case CKK_EC:
|
|
|
b93447 |
+ numAttribs = 1;
|
|
|
b93447 |
+ attribs[0] = CKA_SIGN;
|
|
|
b93447 |
+ if (isExtractable) {
|
|
|
b93447 |
+ attribs[1] = CKA_EXTRACTABLE;
|
|
|
b93447 |
+ numAttribs = 2;
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ break;
|
|
|
b93447 |
case CKK_DSA:
|
|
|
b93447 |
attribs[0] = CKA_SIGN;
|
|
|
b93447 |
numAttribs = 1;
|
|
|
b93447 |
@@ -460,11 +468,6 @@ Java_org_mozilla_jss_pkcs11_PK11KeyWrapp
|
|
|
b93447 |
attribs[0] = CKA_DERIVE;
|
|
|
b93447 |
numAttribs = 1;
|
|
|
b93447 |
break;
|
|
|
b93447 |
- case CKK_EC:
|
|
|
b93447 |
- attribs[0] = CKA_SIGN;
|
|
|
b93447 |
- attribs[1] = CKA_DERIVE;
|
|
|
b93447 |
- numAttribs = 2;
|
|
|
b93447 |
- break;
|
|
|
b93447 |
default:
|
|
|
b93447 |
/* unknown key type */
|
|
|
b93447 |
PR_ASSERT(PR_FALSE);
|
|
|
b93447 |
@@ -479,7 +482,7 @@ Java_org_mozilla_jss_pkcs11_PK11KeyWrapp
|
|
|
b93447 |
attribs, numAttribs, NULL /*wincx*/);
|
|
|
b93447 |
if( privk == NULL ) {
|
|
|
b93447 |
char err[256] = {0};
|
|
|
b93447 |
- PR_snprintf(err, 256, "Key Unwrap failed on token:%d", PR_GetError());
|
|
|
b93447 |
+ PR_snprintf(err, 256, "Key Unwrap failed on token:error=%d, keyType=%d", PR_GetError(), keyType);
|
|
|
b93447 |
JSS_throwMsg(env, TOKEN_EXCEPTION, err);
|
|
|
b93447 |
goto finish;
|
|
|
b93447 |
}
|
|
|
b93447 |
diff -up jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.java.cfuOrig jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.java
|
|
|
b93447 |
--- jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.java.cfuOrig 2012-03-19 17:48:57.298048000 -0700
|
|
|
b93447 |
+++ jss-4.2.6/mozilla/security/jss/org/mozilla/jss/pkcs11/PK11KeyWrapper.java 2012-03-19 17:48:53.471052000 -0700
|
|
|
b93447 |
@@ -459,13 +459,19 @@ final class PK11KeyWrapper implements Ke
|
|
|
b93447 |
if( type == PrivateKey.RSA ) {
|
|
|
b93447 |
if( !(publicKey instanceof RSAPublicKey)) {
|
|
|
b93447 |
throw new InvalidKeyException("Type of public key does not "+
|
|
|
b93447 |
- "match type of private key");
|
|
|
b93447 |
+ "match type of private key which is RSA");
|
|
|
b93447 |
}
|
|
|
b93447 |
return ((RSAPublicKey)publicKey).getModulus().toByteArray();
|
|
|
b93447 |
+ } else if(type == PrivateKey.EC) {
|
|
|
b93447 |
+ if( !(publicKey instanceof PK11ECPublicKey) ) {
|
|
|
b93447 |
+ throw new InvalidKeyException("Type of public key does not "+
|
|
|
b93447 |
+ "match type of private key which is EC");
|
|
|
b93447 |
+ }
|
|
|
b93447 |
+ return ((PK11ECPublicKey)publicKey).getW().toByteArray();
|
|
|
b93447 |
} else if(type == PrivateKey.DSA) {
|
|
|
b93447 |
if( !(publicKey instanceof DSAPublicKey) ) {
|
|
|
b93447 |
throw new InvalidKeyException("Type of public key does not "+
|
|
|
b93447 |
- "match type of private key");
|
|
|
b93447 |
+ "match type of private key which is DSA");
|
|
|
b93447 |
}
|
|
|
b93447 |
return ((DSAPublicKey)publicKey).getY().toByteArray();
|
|
|
b93447 |
} else {
|