Class DERWriter
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.sshd.common.util.io.der.DERWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class DERWriter extends FilterOutputStream
A bare-minimum DER encoder - just enough so we can encoder signatures and keys data- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description DERWriter()
DERWriter(int initialSize)
DERWriter(OutputStream stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DERWriter
startSequence()
byte[]
toByteArray()
void
writeBigInteger(byte... bytes)
The integer is always considered to be positive, so if the first byte is < 0, we pad with a zero to make it positivevoid
writeBigInteger(byte[] bytes, int off, int len)
The integer is always considered to be positive, so if the first byte is < 0, we pad with a zero to make it positivevoid
writeBigInteger(BigInteger value)
void
writeLength(int len)
void
writeObject(byte tag, int len, byte... data)
void
writeObject(ASN1Object obj)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
DERWriter
public DERWriter()
-
DERWriter
public DERWriter(int initialSize)
-
DERWriter
public DERWriter(OutputStream stream)
-
-
Method Detail
-
startSequence
public DERWriter startSequence()
-
writeBigInteger
public void writeBigInteger(BigInteger value) throws IOException
- Throws:
IOException
-
writeBigInteger
public void writeBigInteger(byte... bytes) throws IOException
The integer is always considered to be positive, so if the first byte is < 0, we pad with a zero to make it positive- Parameters:
bytes
-BigInteger
bytes- Throws:
IOException
- If failed to write the bytes
-
writeBigInteger
public void writeBigInteger(byte[] bytes, int off, int len) throws IOException
The integer is always considered to be positive, so if the first byte is < 0, we pad with a zero to make it positive- Parameters:
bytes
-BigInteger
bytesoff
- Offset in bytes datalen
- Number of bytes to write- Throws:
IOException
- If failed to write the bytes
-
writeObject
public void writeObject(ASN1Object obj) throws IOException
- Throws:
IOException
-
writeObject
public void writeObject(byte tag, int len, byte... data) throws IOException
- Throws:
IOException
-
writeLength
public void writeLength(int len) throws IOException
- Throws:
IOException
-
toByteArray
public byte[] toByteArray() throws IOException
- Throws:
IOException
-
-