File tree 2 files changed +10
-8
lines changed
main/java/org/jruby/ext/openssl
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -1683,7 +1683,11 @@ private ASN1Encodable toASN1Primitive(final ThreadContext context) {
1683
1683
if (unused_bits != null ) {
1684
1684
padBits = unused_bits .convertToInteger ("to_i" ).getIntValue ();
1685
1685
}
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
+ }
1687
1691
}
1688
1692
if ( type == DERIA5String .class ) {
1689
1693
return new DERIA5String ( val .asString ().toString () );
Original file line number Diff line number Diff line change @@ -1180,13 +1180,11 @@ def test_bitstring
1180
1180
OpenSSL ::ASN1 . decode ( B ( %w{ 03 03 08 FF 00 } ) )
1181
1181
}
1182
1182
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
+ }
1190
1188
end
1191
1189
1192
1190
def test_bit_string_unused_length
You can’t perform that action at this time.
0 commit comments