Commit 9231c024 by Casey Marshall Committed by Michael Koch

2005-04-22 Casey Marshall <csm@gnu.org>

	* gnu/java/security/der/DERValue.java
	(getValueAs): new method.
	* gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
	(<init>): read both dates with 'DERValue.getValueAs', with
	'GENERALIZED_TIME' as the argument.

From-SVN: r98578
parent d4b47784
2005-04-22 Casey Marshall <csm@gnu.org>
* gnu/java/security/der/DERValue.java
(getValueAs): new method.
* gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
(<init>): read both dates with 'DERValue.getValueAs', with
'GENERALIZED_TIME' as the argument.
2005-04-22 Andrew Pinski <pinskia@physics.uc.edu> 2005-04-22 Andrew Pinski <pinskia@physics.uc.edu>
* gnu/gcj/runtime/NameFinder.java (close): IN, OUT, and PROC can all * gnu/gcj/runtime/NameFinder.java (close): IN, OUT, and PROC can all
......
...@@ -119,6 +119,13 @@ public class DERValue implements DER ...@@ -119,6 +119,13 @@ public class DERValue implements DER
return value; return value;
} }
public Object getValueAs (final int derType) throws IOException
{
byte[] encoded = getEncoded ();
encoded[0] = (byte) derType;
return DERReader.read (encoded).getValue ();
}
public byte[] getEncoded() public byte[] getEncoded()
{ {
if (encoded == null) if (encoded == null)
......
...@@ -71,14 +71,14 @@ public class PrivateKeyUsagePeriod extends Extension.Value ...@@ -71,14 +71,14 @@ public class PrivateKeyUsagePeriod extends Extension.Value
val = der.read(); val = der.read();
if (val.getTagClass() == DER.APPLICATION || val.getTag() == 0) if (val.getTagClass() == DER.APPLICATION || val.getTag() == 0)
{ {
notBefore = (Date) val.getValue(); notBefore = (Date) val.getValueAs (DER.GENERALIZED_TIME);
val = der.read(); val = der.read();
} }
else else
notBefore = null; notBefore = null;
if (val.getTagClass() == DER.APPLICATION || val.getTag() == 1) if (val.getTagClass() == DER.APPLICATION || val.getTag() == 1)
{ {
notAfter = (Date) val.getValue(); notAfter = (Date) val.getValueAs (DER.GENERALIZED_TIME);
} }
else else
notAfter = null; notAfter = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment