From d54787203fdca5fb898df121053f3df3e528887d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenha=C3=ABl=20Pasquiers?= Date: Thu, 10 Oct 2019 14:24:48 +0200 Subject: [PATCH] Correctly encode (pad with zeros) constrained octet strings --- .../mts/asn1/translator/AbstractOctetStringTranslator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mts-asn1-core/src/main/java/com/ericsson/mts/asn1/translator/AbstractOctetStringTranslator.java b/mts-asn1-core/src/main/java/com/ericsson/mts/asn1/translator/AbstractOctetStringTranslator.java index 5cc23cf..1fe3972 100644 --- a/mts-asn1-core/src/main/java/com/ericsson/mts/asn1/translator/AbstractOctetStringTranslator.java +++ b/mts-asn1-core/src/main/java/com/ericsson/mts/asn1/translator/AbstractOctetStringTranslator.java @@ -51,9 +51,7 @@ public final void encode(String name, BitArray s, FormatReader reader, Translato } else { BitArray bitArray = new BitArray(); constraints.getContentTranslator().encode(name, bitArray, reader, translatorContext); - if (!bitArray.getLength().mod(BigInteger.valueOf(8)).equals(BigInteger.ZERO)) { - throw new RuntimeException("specification error ! X.682 : 11.4.a)"); - } + bitArray.skipAlignedBits(); doEncode(s, reader, bitArray.getBinaryMessage()); } }