private static String getPositionMessage(BERInputStream is) { return " at position "+is.getPosition(); }
public static String getPositionMessage(BERInputStream is) { return " at position "+is.getPosition(); }
private static String getPositionMessage(BERInputStream is) { return " at position "+is.getPosition(); }
@Override public void decodeBER(BERInputStream inputStream) throws IOException { long startPos = inputStream.getPosition(); super.decodeBER(inputStream); decodedLength = (int) (inputStream.getPosition() - startPos); }
public int read() throws java.io.IOException { try { return (buffer.get() & 0xFF); } catch (BufferUnderflowException ex) { throw new IOException("Unexpected end of input stream at position "+ getPosition()); } }
public int read() throws java.io.IOException { try { return (buffer.get() & 0xFF); } catch (BufferUnderflowException ex) { throw new IOException("Unexpected end of input stream at position "+ getPosition()); } }
@Override public void decodeBER(BERInputStream inputStream) throws IOException { long startPos = inputStream.getPosition(); super.decodeBER(inputStream); decodedLength = (int) (inputStream.getPosition() - startPos); }
public int read() throws java.io.IOException { try { return (buffer.get() & 0xFF); } catch (BufferUnderflowException ex) { throw new IOException("Unexpected end of input stream at position "+ getPosition()); } }
protected static byte[] buildMessageBuffer(BERInputStream scopedPDU) throws IOException { scopedPDU.mark(16); int readLengthBytes = (int)scopedPDU.getPosition(); BER.MutableByte mutableByte = new BER.MutableByte(); int length = BER.decodeHeader(scopedPDU, mutableByte); readLengthBytes = (int)scopedPDU.getPosition() - readLengthBytes; byte[] buf = new byte[length + readLengthBytes]; scopedPDU.reset(); int offset = 0; int avail = scopedPDU.available(); while ((offset < buf.length) && (avail > 0)) { int read = scopedPDU.read(buf, offset, buf.length - offset); if (read < 0) { break; } offset += read; } return buf; }
public final void decodeBER(BERInputStream inputStream) throws IOException { BER.MutableByte type = new BER.MutableByte(); int length = BER.decodeHeader(inputStream, type); long startPos = inputStream.getPosition(); if (type.getValue() != BER.SEQUENCE) { throw new IOException("Invalid sequence encoding: " + type.getValue()); } oid.decodeBER(inputStream); variable = AbstractVariable.createFromBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }
public final void decodeBER(BERInputStream inputStream) throws IOException { BER.MutableByte type = new BER.MutableByte(); int length = BER.decodeHeader(inputStream, type); long startPos = inputStream.getPosition(); if (type.getValue() != BER.SEQUENCE) { throw new IOException("Invalid sequence encoding: " + type.getValue()); } oid.decodeBER(inputStream); variable = AbstractVariable.createFromBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }
public final void decodeBER(BERInputStream inputStream) throws IOException { BER.MutableByte type = new BER.MutableByte(); int length = BER.decodeHeader(inputStream, type); long startPos = inputStream.getPosition(); if (type.getValue() != BER.SEQUENCE) { throw new IOException("Invalid sequence encoding: " + type.getValue()); } oid.decodeBER(inputStream); variable = AbstractVariable.createFromBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }
public MessageLength getMessageLength(ByteBuffer buf) throws IOException { MutableByte type = new MutableByte(); BERInputStream is = new BERInputStream(buf); int ml = BER.decodeHeader(is, type, false); int hl = (int)is.getPosition(); MessageLength messageLength = new MessageLength(hl, ml); return messageLength; } }
public MessageLength getMessageLength(ByteBuffer buf) throws IOException { MutableByte type = new MutableByte(); BERInputStream is = new BERInputStream(buf); int ml = BER.decodeHeader(is, type, false); int hl = (int) is.getPosition(); MessageLength messageLength = new MessageLength(hl, ml); return messageLength; } }
public MessageLength getMessageLength(ByteBuffer buf) throws IOException { MutableByte type = new MutableByte(); BERInputStream is = new BERInputStream(buf); int ml = BER.decodeHeader(is, type); int hl = (int)is.getPosition(); MessageLength messageLength = new MessageLength(hl, ml); return messageLength; } }
/** * Decodes a <code>ScopedPDU</code> from an <code>InputStream</code>. * * @param inputStream an <code>InputStream</code> containing a BER encoded * byte stream. * @throws IOException * if there is a BER encoding error or other IO exception in the input stream. */ public void decodeBER(BERInputStream inputStream) throws IOException { MutableByte mutableByte = new MutableByte(); int length = BER.decodeHeader(inputStream, mutableByte); long startPos = inputStream.getPosition(); contextEngineID.decodeBER(inputStream); contextName.decodeBER(inputStream); super.decodeBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }
/** * Decodes a <code>ScopedPDU</code> from an <code>InputStream</code>. * * @param inputStream an <code>InputStream</code> containing a BER encoded * byte stream. * @throws IOException */ public void decodeBER(BERInputStream inputStream) throws IOException { MutableByte mutableByte = new MutableByte(); int length = BER.decodeHeader(inputStream, mutableByte); long startPos = inputStream.getPosition(); contextEngineID.decodeBER(inputStream); contextName.decodeBER(inputStream); super.decodeBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }
public static DHParameters getDHParametersFromBER(OctetString berValue) throws IOException { BERInputStream inputStream = new BERInputStream(ByteBuffer.wrap(berValue.getValue())); BER.MutableByte sequenceType = new BER.MutableByte(); int sequenceLength = BER.decodeHeader(inputStream, sequenceType); long headerOffset = inputStream.getPosition(); BER.MutableByte integerType = new BER.MutableByte(); BigInteger prime = BER.decodeBigInteger(inputStream, integerType); BigInteger generator = BER.decodeBigInteger(inputStream, integerType); int privateValueLength = 0; if (inputStream.available() > 0 && inputStream.getPosition() < sequenceLength + headerOffset) { privateValueLength = BER.decodeInteger(inputStream, integerType); } return new DHParameters(prime, generator, privateValueLength); }
public static DHParameters getDHParametersFromBER(OctetString berValue) throws IOException { BERInputStream inputStream = new BERInputStream(ByteBuffer.wrap(berValue.getValue())); BER.MutableByte sequenceType = new BER.MutableByte(); int sequenceLength = BER.decodeHeader(inputStream, sequenceType); long headerOffset = inputStream.getPosition(); BER.MutableByte integerType = new BER.MutableByte(); BigInteger prime = BER.decodeBigInteger(inputStream, integerType); BigInteger generator = BER.decodeBigInteger(inputStream, integerType); int privateValueLength = 0; if (inputStream.available() > 0 && inputStream.getPosition() < sequenceLength + headerOffset) { privateValueLength = BER.decodeInteger(inputStream, integerType); } return new DHParameters(prime, generator, privateValueLength); }
/** * Decodes a <code>ScopedPDU</code> from an <code>InputStream</code>. * * @param inputStream an <code>InputStream</code> containing a BER encoded * byte stream. * @throws IOException * if there is a BER encoding error or other IO exception in the input stream. */ public void decodeBER(BERInputStream inputStream) throws IOException { MutableByte mutableByte = new MutableByte(); int length = BER.decodeHeader(inputStream, mutableByte); long startPos = inputStream.getPosition(); contextEngineID.decodeBER(inputStream); contextName.decodeBER(inputStream); super.decodeBER(inputStream); if (BER.isCheckSequenceLength()) { BER.checkSequenceLength(length, (int) (inputStream.getPosition() - startPos), this); } }