Skip to content

Commit

Permalink
Correctly encode (pad with zeros) constrained octet strings
Browse files Browse the repository at this point in the history
  • Loading branch information
egwepas committed Oct 10, 2019
1 parent b40bbfb commit d547872
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit d547872

Please sign in to comment.