Skip to content


Browse files Browse the repository at this point in the history
8249783: Simplify DerValue and DerInputStream
Reviewed-by: valeriep
  • Loading branch information
wangweij committed Oct 1, 2020
1 parent 9230c2a commit 3c4e824
Show file tree
Hide file tree
Showing 8 changed files with 833 additions and 1,467 deletions.
Expand Up @@ -372,19 +372,18 @@ byte[] convertBytes(byte[] indefData) throws IOException {
* This may block.
* @param in the input stream with tag and lenByte already read
* @param lenByte the length of the length field to remember
* @param tag the tag to remember
* @return a DER byte array
* @throws IOException if not all indef len BER
* can be resolved or another I/O error happens
public static byte[] convertStream(InputStream in, byte lenByte, byte tag)
public static byte[] convertStream(InputStream in, byte tag)
throws IOException {
int offset = 2; // for tag and length bytes
int readLen = in.available();
byte[] indefData = new byte[readLen + offset];
indefData[0] = tag;
indefData[1] = lenByte;
indefData[1] = (byte)0x80;
while (true) {
int bytesRead = in.readNBytes(indefData, offset, readLen);
if (bytesRead != readLen) {
Expand Down

1 comment on commit 3c4e824

Copy link

@bridgekeeper bridgekeeper bot commented on 3c4e824 Oct 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.