summaryrefslogtreecommitdiff
path: root/gnu/java/security
diff options
context:
space:
mode:
authorCasey Marshall <csm@gnu.org>2005-04-22 04:21:53 +0000
committerCasey Marshall <csm@gnu.org>2005-04-22 04:21:53 +0000
commita068f4d01a06427105fffbbdf778d1e5b4e81530 (patch)
treed95e0d10546a78783c796c1ce233ff3e760685d7 /gnu/java/security
parent367a45d4938e186e60ffe21e25131c831f8e6c63 (diff)
downloadclasspath-a068f4d01a06427105fffbbdf778d1e5b4e81530.tar.gz
2005-04-21 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.
Diffstat (limited to 'gnu/java/security')
-rw-r--r--gnu/java/security/der/DERValue.java7
-rw-r--r--gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java4
2 files changed, 9 insertions, 2 deletions
diff --git a/gnu/java/security/der/DERValue.java b/gnu/java/security/der/DERValue.java
index bad7beda9..9c3431e0b 100644
--- a/gnu/java/security/der/DERValue.java
+++ b/gnu/java/security/der/DERValue.java
@@ -119,6 +119,13 @@ public class DERValue implements DER
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()
{
if (encoded == null)
diff --git a/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java b/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
index 8e7e9e230..c56cd27cf 100644
--- a/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
+++ b/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
@@ -71,14 +71,14 @@ public class PrivateKeyUsagePeriod extends Extension.Value
val = der.read();
if (val.getTagClass() == DER.APPLICATION || val.getTag() == 0)
{
- notBefore = (Date) val.getValue();
+ notBefore = (Date) val.getValueAs (DER.GENERALIZED_TIME);
val = der.read();
}
else
notBefore = null;
if (val.getTagClass() == DER.APPLICATION || val.getTag() == 1)
{
- notAfter = (Date) val.getValue();
+ notAfter = (Date) val.getValueAs (DER.GENERALIZED_TIME);
}
else
notAfter = null;