File tree Expand file tree Collapse file tree
main/java/org/jruby/ext/openssl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1683,7 +1683,11 @@ private ASN1Encodable toASN1Primitive(final ThreadContext context) {
16831683 if (unused_bits != null ) {
16841684 padBits = unused_bits .convertToInteger ("to_i" ).getIntValue ();
16851685 }
1686- return new DERBitString (data , padBits );
1686+ try {
1687+ return new DERBitString (data , padBits );
1688+ } catch (IllegalArgumentException e ) {
1689+ throw newASN1Error (context .runtime , e .getMessage ());
1690+ }
16871691 }
16881692 if ( type == DERIA5String .class ) {
16891693 return new DERIA5String ( val .asString ().toString () );
Original file line number Diff line number Diff line change @@ -1180,13 +1180,11 @@ def test_bitstring
11801180 OpenSSL ::ASN1 . decode ( B ( %w{ 03 03 08 FF 00 } ) )
11811181 }
11821182
1183- # TODO: Import Issue
1184- # exception was expected but none was thrown.
1185- #assert_raise(OpenSSL::ASN1::ASN1Error) {
1186- # obj = OpenSSL::ASN1::BitString.new(B(%w{ FF FF }))
1187- # obj.unused_bits = 8
1188- # obj.to_der
1189- #}
1183+ assert_raise ( OpenSSL ::ASN1 ::ASN1Error ) {
1184+ obj = OpenSSL ::ASN1 ::BitString . new ( B ( %w{ FF FF } ) )
1185+ obj . unused_bits = 8
1186+ obj . to_der
1187+ }
11901188 end
11911189
11921190 def test_bit_string_unused_length
You can’t perform that action at this time.
0 commit comments