From 1f7fb9ce3e2d1690050e2a4fd8759c4adb26617c Mon Sep 17 00:00:00 2001 From: Stephen Dawkins Date: Mon, 19 May 2025 10:35:52 +0100 Subject: [PATCH] Implemented decodeString method The decodeString method is introduced to allow the decoding of constructed strings. This method requires that a tag is passed in so that it can be determined at runtime whether this string is constructed or not. --- .../com/beanit/asn1bean/ber/types/BerOctetString.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/asn1bean/src/main/java/com/beanit/asn1bean/ber/types/BerOctetString.java b/projects/asn1bean/src/main/java/com/beanit/asn1bean/ber/types/BerOctetString.java index 094e04f3..4d6ac7b3 100644 --- a/projects/asn1bean/src/main/java/com/beanit/asn1bean/ber/types/BerOctetString.java +++ b/projects/asn1bean/src/main/java/com/beanit/asn1bean/ber/types/BerOctetString.java @@ -60,6 +60,14 @@ public int decode(InputStream is) throws IOException { return decode(is, true); } + public int decodeString(InputStream is, BerTag tag) throws IOException { + if (tag.primitive == BerTag.CONSTRUCTED) { + return decodeConstructedOctetString(is); + } + + return decodePrimitiveOctetString(is); + } + public int decode(InputStream is, boolean withTag) throws IOException { if (withTag) {