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 booleanisPositive(byte b) byte[]voidwrite(byte[] b, int off, int len) voidwriteBigInteger(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 positivevoidwriteBigInteger(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 positivevoidwriteBigInteger(BigInteger value) voidwriteLength(int len) voidwriteObject(byte tag, int len, byte... data) voidwriteObject(ASN1Object obj) Methods inherited from class java.io.FilterOutputStream
close, flush, write, write
-
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 < 0, we pad with a zero to make it positive- Parameters:
bytes-BigIntegerbytes- Throws:
IOException- If failed to write the bytes
-
writeBigInteger
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-BigIntegerbytesoff- 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:
writein classFilterOutputStream- Throws:
IOException
-
writeLength
- Throws:
IOException
-
toByteArray
- Throws:
IOException
-