@@ -175,25 +175,21 @@ private byte[] getSignature() {
175
175
return getCRL ().getSignature ();
176
176
}
177
177
178
- private static boolean avoidJavaSecurity = false ;
178
+ private static final boolean avoidJavaSecurity = false ; // true NOT SUPPORTED
179
179
180
- private static java .security .cert .X509CRL generateCRL (
181
- final byte [] bytes , final int offset , final int length )
180
+ private static java .security .cert .X509CRL generateCRL (final byte [] bytes , final int offset , final int length )
182
181
throws GeneralSecurityException {
183
182
CertificateFactory factory = SecurityHelper .getCertificateFactory ("X.509" );
184
- return (java .security .cert .X509CRL ) factory .generateCRL (
185
- new ByteArrayInputStream (bytes , offset , length )
186
- );
183
+ return (java .security .cert .X509CRL ) factory .generateCRL (new ByteArrayInputStream (bytes , offset , length ));
187
184
}
188
185
189
- private static X509CRLHolder parseCRLHolder (
190
- final byte [] bytes , final int offset , final int length ) throws IOException {
186
+ private static X509CRLHolder parseCRLHolder (final byte [] bytes , final int offset , final int length )
187
+ throws IOException {
191
188
return new X509CRLHolder (new ByteArrayInputStream (bytes , offset , length ));
192
189
}
193
190
194
191
@ JRubyMethod (name = "initialize" , rest = true , visibility = Visibility .PRIVATE )
195
- public IRubyObject initialize (final ThreadContext context ,
196
- final IRubyObject [] args , final Block block ) {
192
+ public IRubyObject initialize (final ThreadContext context , final IRubyObject [] args , final Block block ) {
197
193
final Ruby runtime = context .runtime ;
198
194
199
195
this .extensions = runtime .newArray (8 );
@@ -220,6 +216,10 @@ public IRubyObject initialize(final ThreadContext context,
220
216
throw newCRLError (runtime , e );
221
217
}
222
218
219
+ if (this .crl == null ) {
220
+ throw newCRLError (runtime , "" ); // MRI: "header too long" for OpenSSL::X509::CRL.new('')
221
+ }
222
+
223
223
set_last_update ( context , RubyTime .newTime (runtime , crl .getThisUpdate ().getTime ()) );
224
224
set_next_update ( context , RubyTime .newTime (runtime , crl .getNextUpdate ().getTime ()) );
225
225
set_issuer ( X509Name .newName (runtime , crl .getIssuerX500Principal ()) );
0 commit comments