On Monday 06 February 2006 20:40, Raif S. Naffah wrote: > ... > this is a patch that fixes a wrong OID string...
the previous patch did not include the RSA changes. the attached patch is the correct one. cheers; rsn
Index: EncodedKeyFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/EncodedKeyFactory.java,v retrieving revision 1.4 diff -u -r1.4 EncodedKeyFactory.java --- EncodedKeyFactory.java 2 Jul 2005 20:32:14 -0000 1.4 +++ EncodedKeyFactory.java 6 Feb 2006 09:16:45 -0000 @@ -39,6 +39,7 @@ package gnu.java.security.provider; import gnu.java.security.OID; +import gnu.java.security.Registry; import gnu.java.security.der.BitString; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; @@ -75,9 +76,9 @@ // Constants. // ------------------------------------------------------------------------ - private static final OID ID_DSA = new OID("1.2.840.10040.4.1"); - private static final OID ID_RSA = new OID("1.2.840.113549.1.1.1"); - private static final OID ID_DH = new OID("1.2.840.10046.2.1"); + private static final OID ID_DSA = new OID(Registry.DSA_OID_STRING); + private static final OID ID_RSA = new OID(Registry.RSA_OID_STRING); + private static final OID ID_DH = new OID(Registry.DH_OID_STRING); // Instance methods. // ------------------------------------------------------------------------ Index: GnuDSAPrivateKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/GnuDSAPrivateKey.java,v retrieving revision 1.7 diff -u -r1.7 GnuDSAPrivateKey.java --- GnuDSAPrivateKey.java 2 Jul 2005 20:32:14 -0000 1.7 +++ GnuDSAPrivateKey.java 6 Feb 2006 09:17:12 -0000 @@ -39,6 +39,7 @@ package gnu.java.security.provider; import gnu.java.security.OID; +import gnu.java.security.Registry; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; import gnu.java.security.der.DERWriter; @@ -110,7 +111,7 @@ pki.add(new DERValue(DER.INTEGER, BigInteger.ZERO)); ArrayList algId = new ArrayList(2); algId.add(new DERValue(DER.OBJECT_IDENTIFIER, - new OID("1.2.840.10040.4.1"))); + new OID(Registry.DSA_OID_STRING))); ArrayList algParams = new ArrayList(3); algParams.add(new DERValue(DER.INTEGER, p)); algParams.add(new DERValue(DER.INTEGER, q)); Index: GnuDSAPublicKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/GnuDSAPublicKey.java,v retrieving revision 1.7 diff -u -r1.7 GnuDSAPublicKey.java --- GnuDSAPublicKey.java 2 Jul 2005 20:32:14 -0000 1.7 +++ GnuDSAPublicKey.java 6 Feb 2006 09:17:33 -0000 @@ -39,6 +39,7 @@ package gnu.java.security.provider; import gnu.java.security.OID; +import gnu.java.security.Registry; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; @@ -97,7 +98,7 @@ ArrayList spki = new ArrayList(2); ArrayList alg = new ArrayList(2); alg.add(new DERValue(DER.OBJECT_IDENTIFIER, - new OID("1.2.840.113549.1.1.1"))); + new OID(Registry.DSA_OID_STRING))); ArrayList params = new ArrayList(3); params.add(new DERValue(DER.INTEGER, p)); params.add(new DERValue(DER.INTEGER, q)); Index: Registry.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/Registry.java,v retrieving revision 1.2 diff -u -r1.2 Registry.java --- Registry.java 28 Jan 2006 02:47:57 -0000 1.2 +++ Registry.java 6 Feb 2006 09:17:59 -0000 @@ -263,9 +263,28 @@ // String TMMH32 = "tmmh32"; // Format IDs used to identify how we externalise asymmetric keys .......... + // fully-qualified names of the supported codecs String RAW_ENCODING = "gnu.crypto.raw.format"; + String X509_ENCODING = "gnu.crypto.x509.format"; + String PKCS8_ENCODING = "gnu.crypto.pkcs8.format"; + String ASN1_ENCODING = "gnu.crypto.asn1.format"; + + // short names of the same. used by JCE adapters + String RAW_ENCODING_SHORT_NAME = "RAW"; + String X509_ENCODING_SORT_NAME = "X.509"; + String PKCS8_ENCODING_SHORT_NAME = "PKCS#8"; + String ASN1_ENCODING_SHORT_NAME = "ASN.1"; + // unique identifiers of the same int RAW_ENCODING_ID = 1; + int X509_ENCODING_ID = 2; + int PKCS8_ENCODING_ID = 3; + int ASN1_ENCODING_ID = 4; + + // OID strings used in encoding/decoding keys + String DSA_OID_STRING = "1.2.840.10040.4.1"; + String RSA_OID_STRING = "1.2.840.113549.1.1.1"; + String DH_OID_STRING = "1.2.840.10046.2.1"; // Magic bytes we generate/expect in externalised asymmetric keys .......... // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format, Index: GnuRSAPublicKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/GnuRSAPublicKey.java,v retrieving revision 1.3 diff -u -r1.3 GnuRSAPublicKey.java --- GnuRSAPublicKey.java 2 Jul 2005 20:32:14 -0000 1.3 +++ GnuRSAPublicKey.java 6 Feb 2006 09:34:53 -0000 @@ -39,6 +39,7 @@ package gnu.java.security.provider; import gnu.java.security.OID; +import gnu.java.security.Registry; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; @@ -98,7 +99,7 @@ DERValue rsapk = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, key); ArrayList alg = new ArrayList(2); alg.add(new DERValue(DER.OBJECT_IDENTIFIER, - new OID("1.2.840.113549.1.1.1"))); + new OID(Registry.RSA_OID_STRING))); alg.add(new DERValue(DER.NULL, null)); ArrayList spki = new ArrayList(2); spki.add(new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, alg)); Index: GnuRSAPrivateKey.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/security/provider/GnuRSAPrivateKey.java,v retrieving revision 1.3 diff -u -r1.3 GnuRSAPrivateKey.java --- GnuRSAPrivateKey.java 2 Jul 2005 20:32:14 -0000 1.3 +++ GnuRSAPrivateKey.java 6 Feb 2006 09:35:26 -0000 @@ -39,6 +39,7 @@ package gnu.java.security.provider; import gnu.java.security.OID; +import gnu.java.security.Registry; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; @@ -154,7 +155,7 @@ pki.add(new DERValue(DER.INTEGER, BigInteger.ZERO)); ArrayList alg = new ArrayList(2); alg.add(new DERValue(DER.OBJECT_IDENTIFIER, - new OID("1.2.840.113549.1.1.1"))); + new OID(Registry.RSA_OID_STRING))); alg.add(new DERValue(DER.NULL, null)); pki.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, alg)); pki.add(new DERValue(DER.OCTET_STRING, pk.getEncoded()));
pgpaTBjWw2ejk.pgp
Description: PGP signature