Top Description Fields Constructors Methods
org.apache.sshd.common.util.io.der

public Class DERWriter

extends FilterOutputStream
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .FilterOutputStream, .IOException, .OutputStream, .StreamCorruptedException, java.math.BigInteger, java.util.Objects, java.util.concurrent.atomic.AtomicBoolean, org.apache.sshd.common.util.NumberUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.BufferUtils, .ByteArrayBuffer

A bare-minimum DER encoder - just enough so we can encoder signatures and keys data
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private final byte[]
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
public
DERWriter(int initialSize)

public

Method Summary

Modifier and TypeMethod and Description
private boolean
isPositive(byte b)

public DERWriter
public byte[]
public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

public void
public 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 positive

public void
writeBigInteger(byte[] bytes, int
Offset in bytes data
off
,
int
Number of bytes to write
len
)

The integer is always considered to be positive, so if the first byte is < 0, we pad with a zero to make it positive

public void
writeLength(int len)

public void
public void
writeObject(byte tag, int len, byte... data)

Inherited from java.io.FilterOutputStream:
closeflushwritewrite

Field Detail

lenBytesback to summary
private final byte[] lenBytes

Constructor Detail

DERWriterback to summary
public DERWriter()
DERWriterback to summary
public DERWriter(int initialSize)
DERWriterback to summary
public DERWriter(OutputStream stream)

Method Detail

isPositiveback to summary
private boolean isPositive(byte b)
startSequenceback to summary
public DERWriter startSequence()
toByteArrayback to summary
public byte[] toByteArray() throws IOException
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeBigIntegerback to summary
public void writeBigInteger(BigInteger value) throws IOException
writeBigIntegerback to summary
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:byte[]

BigInteger bytes

Exceptions
IOException:
If failed to write the bytes
writeBigIntegerback to summary
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:byte[]

BigInteger bytes

off:int

Offset in bytes data

len:int

Number of bytes to write

Exceptions
IOException:
If failed to write the bytes
writeLengthback to summary
public void writeLength(int len) throws IOException
writeObjectback to summary
public void writeObject(ASN1Object obj) throws IOException
writeObjectback to summary
public void writeObject(byte tag, int len, byte... data) throws IOException