summaryrefslogtreecommitdiff
path: root/gnu/java/security/der/DERReader.java
diff options
context:
space:
mode:
authorCasey Marshall <csm@gnu.org>2004-11-07 20:27:47 +0000
committerCasey Marshall <csm@gnu.org>2004-11-07 20:27:47 +0000
commitc7beb2e15aab929442532def7adc6eca7478246d (patch)
treebf76c22a3bbec8c0700a1d147c25780bd69a1e67 /gnu/java/security/der/DERReader.java
parentd73d0fa5384f57abcfe473482296d4604662571a (diff)
downloadclasspath-c7beb2e15aab929442532def7adc6eca7478246d.tar.gz
2004-11-07 Casey Marshall <csm@gnu.org>
Signed JAR file support. * java/net/URLClassLoader.java (JarURLResource.getCertificates): re-read jar entry to ensure certificates are picked up. (findClass): fill in class `signers' field, too. * java/util/jar/JarFile.java (META_INF): new constant. (PKCS7_DSA_SUFFIX): new constant. (PKCS7_RSA_SUFFIX): new constant. (DIGEST_KEY_SUFFIX): new constant. (SF_SUFFIX): new constant. (MD2_OID): new constant. (MD4_OID): new constant. (MD5_OID): new constant. (SHA1_OID): new constant. (DSA_ENCRYPTION_OID): new constant. (RSA_ENCRYPTION_OID): new constant. (signaturesRead): new field. (verified): new field. (entryCerts): new field. (DEBUG): new constant. (debug): new method. (JarEnumeration.nextElement): fill in entry certificates, read signatures if they haven't been read. (getEntry): likewise. (getInputStream): verify stream if it hasn't been verified yet. (readSignatures): new method. (verify): new method. (verifyHashes): new method. (readManifestEntry): new method. (EntryInputStream): new class. * java/util/zip/InflaterInputStream.java Don't defer to underlying stream for mark/reset. (markSupported): new method; return `false'. (mark): new method. (reset): new method. * gnu/java/io/Base64InputStream.java (decode): new class method. * gnu/java/security/der/DERReader.java don't make class final. (in): made protected. (encBuf): likewise. (readLength): likewise. * gnu/java/security/ber/BER.java, * gnu/java/security/ber/BEREncodingException.java, * gnu/java/security/ber/BERReader.java, * gnu/java/security/ber/BERValue.java, * gnu/java/security/pkcs/PKCS7SignedData.java, * gnu/java/security/pkcs/SignerInfo.java: new files.
Diffstat (limited to 'gnu/java/security/der/DERReader.java')
-rw-r--r--gnu/java/security/der/DERReader.java46
1 files changed, 23 insertions, 23 deletions
diff --git a/gnu/java/security/der/DERReader.java b/gnu/java/security/der/DERReader.java
index 7d7174d6d..688b509eb 100644
--- a/gnu/java/security/der/DERReader.java
+++ b/gnu/java/security/der/DERReader.java
@@ -62,15 +62,15 @@ import gnu.java.security.OID;
*
* @author Casey Marshall (csm@gnu.org)
*/
-public final class DERReader implements DER
+public class DERReader implements DER
{
// Fields.
// ------------------------------------------------------------------------
- private InputStream in;
+ protected InputStream in;
- private final ByteArrayOutputStream encBuf;
+ protected final ByteArrayOutputStream encBuf;
// Constructor.
// ------------------------------------------------------------------------
@@ -185,6 +185,26 @@ public final class DERReader implements DER
return value;
}
+ protected int readLength() throws IOException
+ {
+ int i = in.read();
+ if (i == -1)
+ throw new EOFException();
+ encBuf.write(i);
+ if ((i & ~0x7F) == 0)
+ {
+ return i;
+ }
+ else if (i < 0xFF)
+ {
+ byte[] octets = new byte[i & 0x7F];
+ in.read(octets);
+ encBuf.write(octets);
+ return new BigInteger(1, octets).intValue();
+ }
+ throw new DEREncodingException();
+ }
+
// Own methods.
// ------------------------------------------------------------------------
@@ -236,26 +256,6 @@ public final class DERReader implements DER
}
}
- private int readLength() throws IOException
- {
- int i = in.read();
- if (i == -1)
- throw new EOFException();
- encBuf.write(i);
- if ((i & ~0x7F) == 0)
- {
- return i;
- }
- else if (i < 0xFF)
- {
- byte[] octets = new byte[i & 0x7F];
- in.read(octets);
- encBuf.write(octets);
- return new BigInteger(1, octets).intValue();
- }
- throw new DEREncodingException();
- }
-
private static String makeString(int tag, byte[] value)
throws IOException
{