@@ -175,25 +175,21 @@ private byte[] getSignature() {
175175 return getCRL ().getSignature ();
176176 }
177177
178- private static boolean avoidJavaSecurity = false ;
178+ private static final boolean avoidJavaSecurity = false ; // true NOT SUPPORTED
179179
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 )
182181 throws GeneralSecurityException {
183182 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 ));
187184 }
188185
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 {
191188 return new X509CRLHolder (new ByteArrayInputStream (bytes , offset , length ));
192189 }
193190
194191 @ 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 ) {
197193 final Ruby runtime = context .runtime ;
198194
199195 this .extensions = runtime .newArray (8 );
@@ -220,6 +216,10 @@ public IRubyObject initialize(final ThreadContext context,
220216 throw newCRLError (runtime , e );
221217 }
222218
219+ if (this .crl == null ) {
220+ throw newCRLError (runtime , "" ); // MRI: "header too long" for OpenSSL::X509::CRL.new('')
221+ }
222+
223223 set_last_update ( context , RubyTime .newTime (runtime , crl .getThisUpdate ().getTime ()) );
224224 set_next_update ( context , RubyTime .newTime (runtime , crl .getNextUpdate ().getTime ()) );
225225 set_issuer ( X509Name .newName (runtime , crl .getIssuerX500Principal ()) );
0 commit comments