iaik.utils
Class ASN1InputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--iaik.utils.Base64InputStream
|
+--iaik.utils.ASN1InputStream
- public class ASN1InputStream
- extends Base64InputStream
This Filter-InputStream can be used to read a lot of different
formats for ASN.1 objects. The data which can be read from this stream
is always binary DER encoded ASN.1!
The following formats have been tested:
- one or more binary DER encoded ASN.1 objects
0x30 0x82 0x03 0xE9 ...
- one or more Base64/DER encoded ASN.1 objects
MIIB2zCCAUQCBQC3xiKfMA0GCSqGSIb3DQEBBAUAMDUxCzAJBgNVBAYTAkFUMQ0w
...
PZm5TIGAxUXR96AalaJwvG8wdk+l3t1BmMI6
MIIB2zCCAUQCBQC3xiKfMA0GCSqGSIb3DQEBBAUAMDUxCzAJBgNVBAYTAkFUMQ0w
...
Sk03xc18zfv5DhZ8Vuz3Nk1qgi1mPq0krImanGtFtBszSSnmpNW08ujUTvGHhDk=
- one or more Base64/DER encoded ASN.1 objects with BEGIN/END
-----BEGIN CERTIFICATE-----
MIIB9zCCAWACBEZWm84wDQYJKoZIhvcNAQEEBQAwNTELMAkGA1UEBhMCQVQxDTAL
...
PZm5TIGAxUXR96AalaJwvG8wdk+l3t1BmMI6
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB2zCCAUQCBQC3xiKfMA0GCSqGSIb3DQEBBAUAMDUxCzAJBgNVBAYTAkFUMQ0w
...
Sk03xc18zfv5DhZ8Vuz3Nk1qgi1mPq0krImanGtFtBszSSnmpNW08ujUTvGHhDk=
-----END CERTIFICATE-----
| Fields inherited from class java.io.FilterInputStream |
in |
|
Constructor Summary |
ASN1InputStream(java.io.InputStream is)
Creates a new ASN1InputStream to read data from the specified
input stream. |
|
Method Summary |
int |
available()
Returns the number of bytes that can be read from this input
stream without blocking. |
protected void |
notify(byte[] buffer)
Called by super class if a '-' shall be decoded. |
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input stream into an array of bytes. |
| Methods inherited from class java.io.FilterInputStream |
close,
mark,
markSupported,
read,
reset,
skip |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ASN1InputStream
public ASN1InputStream(java.io.InputStream is)
throws java.io.IOException
- Creates a new ASN1InputStream to read data from the specified
input stream.
- Parameters:
is - the underlying input stream- Throws:
- java.io.IOException - if an I/O error occurs during reading from the stream
notify
protected void notify(byte[] buffer)
throws java.io.IOException
- Called by super class if a '-' shall be decoded.
- Overrides:
- notify in class Base64InputStream
- Tags copied from class: Base64InputStream
- Parameters:
buffer - the characters already read from the input stream; and the
first one was marked with NOTIFY- Throws:
- java.io.IOException - allows the subclass to throw an Exception if an error occurs
read
public int read()
throws java.io.IOException
- Reads the next byte of data from this input stream.
- Overrides:
- read in class Base64InputStream
- Returns:
- the next byte of data, or -1 if the end of the stream is reached
- Throws:
- java.io.IOException - if an I/O error occurs
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Reads up to len bytes of data from this input stream into an array of bytes.
- Overrides:
- read in class Base64InputStream
- Parameters:
b - the buffer into which the data is readoff - the start offset of the datalen - the maximum number of bytes read- Returns:
- the total number of bytes read into the buffer, or -1
if there is no more data because the end of the stream has been reached
- Throws:
- java.io.IOException - if an I/O error occurs
available
public int available()
throws java.io.IOException
- Returns the number of bytes that can be read from this input
stream without blocking.
- Overrides:
- available in class java.io.FilterInputStream
- Returns:
- the number of bytes that can be read from the input stream
without blocking
- Throws:
- java.io.IOException - if an I/O error occurs