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
This commit is contained in:
parent
27079765d0
commit
8aa540d2f7
1367 changed files with 188789 additions and 22762 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue