diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
commit | 8aa540d2f783474d1d2e06f16744bf67b9c1facc (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/javax/crypto | |
parent | 27079765d00123f8e53d0e1ef7f9d46559266e6d (diff) | |
download | gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.zip gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.gz gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.bz2 |
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r111942
Diffstat (limited to 'libjava/classpath/javax/crypto')
-rw-r--r-- | libjava/classpath/javax/crypto/EncryptedPrivateKeyInfo.java | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/libjava/classpath/javax/crypto/EncryptedPrivateKeyInfo.java b/libjava/classpath/javax/crypto/EncryptedPrivateKeyInfo.java index a52d7b1..0fddd54 100644 --- a/libjava/classpath/javax/crypto/EncryptedPrivateKeyInfo.java +++ b/libjava/classpath/javax/crypto/EncryptedPrivateKeyInfo.java @@ -92,6 +92,9 @@ public class EncryptedPrivateKeyInfo /** The OID of the encryption algorithm. */ private OID algOid; + /** The encryption algorithm name. */ + private String algName; + /** The encryption algorithm's parameters. */ private AlgorithmParameters params; @@ -125,7 +128,8 @@ public class EncryptedPrivateKeyInfo throw new IllegalArgumentException("0-length encryptedData"); } this.params = params; - algOid = new OID(params.getAlgorithm()); + algName = params.getAlgorithm (); + algOid = getOid (algName); this.encryptedData = (byte[]) encryptedData.clone(); } @@ -168,10 +172,36 @@ public class EncryptedPrivateKeyInfo { throw new IllegalArgumentException("0-length encryptedData"); } - this.algOid = new OID(algName); + this.algName = algName.toString (); // do NP check + this.algOid = getOid (algName); this.encryptedData = (byte[]) encryptedData.clone(); } + /** + * Return the OID for the given cipher name. + * + * @param str The string. + * @throws NoSuchAlgorithmException If the OID is not known. + */ + private static OID getOid (final String str) + throws NoSuchAlgorithmException + { + if (str.equalsIgnoreCase ("DSA")) + { + return new OID ("1.2.840.10040.4.3"); + } + // FIXME add more + + try + { + return new OID (str); + } + catch (Throwable t) + { + } + throw new NoSuchAlgorithmException ("cannot determine OID for '" + str + "'"); + } + // Instance methods. // ------------------------------------------------------------------------ @@ -196,6 +226,7 @@ public class EncryptedPrivateKeyInfo } catch (NoSuchAlgorithmException ignore) { + // FIXME throw exception? } catch (IOException ignore) { @@ -272,7 +303,11 @@ public class EncryptedPrivateKeyInfo getAlgParameters(); if (params != null) { - algId.add(DERReader.read(params.getEncoded())); + algId.add (DERReader.read (params.getEncoded())); + } + else + { + algId.add (new DERValue (DER.NULL, null)); } List epki = new ArrayList(2); epki.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, algId)); |