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
A bare-minimum DER encoder - just enough so we can encoder signatures and keys data
-
Field Summary
FieldsFields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
isPositive
(byte b) byte[]
void
write
(byte[] b, int off, int len) void
writeBigInteger
(byte... bytes) The integer is always considered to be positive, so if the first byte is invalid input: '<' 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 invalid input: '<' 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.FilterOutputStream
close, flush, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
lenBytes
private final byte[] lenBytes
-
-
Constructor Details
-
DERWriter
public DERWriter() -
DERWriter
public DERWriter(int initialSize) -
DERWriter
-
-
Method Details
-
startSequence
-
writeBigInteger
- Throws:
IOException
-
writeBigInteger
The integer is always considered to be positive, so if the first byte is invalid input: '<' 0, we pad with a zero to make it positive- Parameters:
bytes
-BigInteger
bytes- Throws:
IOException
- If failed to write the bytes
-
writeBigInteger
The integer is always considered to be positive, so if the first byte is invalid input: '<' 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
-
isPositive
private boolean isPositive(byte b) -
writeObject
- Throws:
IOException
-
writeObject
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
writeLength
- Throws:
IOException
-
toByteArray
- Throws:
IOException
-