@Override public int decode(InputStream is) throws IOException { return decode(is, null); }
private void encodePresentationLayer(ByteBuffer payload, List<byte[]> ssduList, List<Integer> ssduOffsets, List<Integer> ssduLengths) throws IOException { PDVList pdv_list = new PDVList(); pdv_list.setPresentationContextIdentifier(new PresentationContextIdentifier(3l)); PDVList.PresentationDataValues presentationDataValues = new PDVList.PresentationDataValues(); presentationDataValues.setSingleASN1Type( new BerAny(Arrays.copyOfRange(payload.array(), payload.position(), payload.limit()))); pdv_list.setPresentationDataValues(presentationDataValues); FullyEncodedData fully_encoded_data = new FullyEncodedData(); List<PDVList> pdv_list_list = fully_encoded_data.getPDVList(); pdv_list_list.add(pdv_list); UserData user_data = new UserData(); user_data.setFullyEncodedData(fully_encoded_data); ReverseByteArrayOutputStream reverseOStream = new ReverseByteArrayOutputStream(200, true); user_data.encode(reverseOStream); ssduList.add(reverseOStream.buffer); ssduOffsets.add(reverseOStream.index + 1); ssduLengths.add(reverseOStream.buffer.length - (reverseOStream.index + 1)); }
sublength = singleASN1Type.encode(os); codeLength += sublength; codeLength += BerLength.encodeLength(os, sublength);
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
sublength = singleASN1Type.encode(os); codeLength += sublength; codeLength += BerLength.encodeLength(os, sublength);
@Override public int decode(InputStream is) throws IOException { return decode(is, null); }
private void encodePresentationLayer(ByteBuffer payload, List<byte[]> ssduList, List<Integer> ssduOffsets, List<Integer> ssduLengths) throws IOException { PDVList pdv_list = new PDVList(); pdv_list.setPresentationContextIdentifier(new PresentationContextIdentifier(3l)); PDVList.PresentationDataValues presentationDataValues = new PDVList.PresentationDataValues(); presentationDataValues.setSingleASN1Type( new BerAny(Arrays.copyOfRange(payload.array(), payload.position(), payload.limit()))); pdv_list.setPresentationDataValues(presentationDataValues); FullyEncodedData fully_encoded_data = new FullyEncodedData(); List<PDVList> pdv_list_list = fully_encoded_data.getPDVList(); pdv_list_list.add(pdv_list); UserData user_data = new UserData(); user_data.setFullyEncodedData(fully_encoded_data); ReverseByteArrayOutputStream reverseOStream = new ReverseByteArrayOutputStream(200, true); user_data.encode(reverseOStream); ssduList.add(reverseOStream.buffer); ssduOffsets.add(reverseOStream.index + 1); ssduLengths.add(reverseOStream.buffer.length - (reverseOStream.index + 1)); }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
sublength = singleASN1Type.encode(os); codeLength += sublength; codeLength += BerLength.encodeLength(os, sublength);
@Override public int decode(InputStream is) throws IOException { return decode(is, null); }
private static UserData getPresentationUserDataField(byte[] userDataBytes) { PDVList.PresentationDataValues presDataValues = new PDVList.PresentationDataValues(); presDataValues.setSingleASN1Type(new BerAny(userDataBytes)); PDVList pdvList = new PDVList(); pdvList.setPresentationContextIdentifier(acsePresentationContextId); pdvList.setPresentationDataValues(presDataValues); FullyEncodedData fullyEncodedData = new FullyEncodedData(); List<PDVList> pdvListList = fullyEncodedData.getPDVList(); pdvListList.add(pdvList); UserData userData = new UserData(); userData.setFullyEncodedData(fullyEncodedData); return userData; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
sublength = singleASN1Type.encode(os); codeLength += sublength; codeLength += BerLength.encodeLength(os, sublength);
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); codeLength += super.decode(is, null); return codeLength; }
private static UserData getPresentationUserDataField(byte[] userDataBytes) { PDVList.PresentationDataValues presDataValues = new PDVList.PresentationDataValues(); presDataValues.setSingleASN1Type(new BerAny(userDataBytes)); PDVList pdvList = new PDVList(); pdvList.setPresentationContextIdentifier(acsePresentationContextId); pdvList.setPresentationDataValues(presDataValues); FullyEncodedData fullyEncodedData = new FullyEncodedData(); List<PDVList> pdvListList = fullyEncodedData.getPDVList(); pdvListList.add(pdvList); UserData userData = new UserData(); userData.setFullyEncodedData(fullyEncodedData); return userData; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); singleASN1Type = new BerAny(); codeLength += singleASN1Type.decode(is, null); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { octetAligned = new BerOctetString(); codeLength += octetAligned.decode(is, false); return codeLength; } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { arbitrary = new BerBitString(); codeLength += arbitrary.decode(is, false); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
sublength = singleASN1Type.encode(os); codeLength += sublength; codeLength += BerLength.encodeLength(os, sublength);
BerAny anyPayload = new BerAny(Arrays.copyOfRange(payload.array(), payload.position(), payload.limit()));