title: Spongycastle Signature.sign() returns null
body: <p>Using <strong>com.madgag.spongycastle:pkix:1.54.0.0</strong> on <strong>Android 7.0</strong>     </p>
  
  <pre><code>  byte[] testData = "test data".getBytes("UTF_8");
    Signature sign = Signature.getInstance("SHA256withRSA");
    sign.initSign(privateKey);
    sign.update(testData);
    byte[] signature = sign.sign();
    assert signature != null;
  </code></pre>
  
  <p>Assert would fail occasionally.</p>
  
  <p><strong>Any clue why/when sign() method can return null ?</strong></p>
  
  <p><strong>Stacktraces:</strong></p>
  
  <p>(1) When trying to generate CSR</p>
  
  <pre><code>Caused by java.lang.NullPointerException: data cannot be null
         at org.spongycastle.asn1.ASN1BitString.(ASN1BitString.java:114)
         at org.spongycastle.asn1.DERBitString.(DERBitString.java:83)
         at org.spongycastle.asn1.DERBitString.(DERBitString.java:89)
         at org.spongycastle.pkcs.PKCS10CertificationRequestBuilder.build(PKCS10CertificationRequestBuilder.java:149)
  </code></pre>
  
  <p>(2) When trying to verify test signature</p>
  
  <pre><code>Caused by java.security.SignatureException: java.lang.NullPointerException: Attempt to get length of null array
         at com.android.org.conscrypt.OpenSSLSignature.engineVerify(OpenSSLSignature.java:258)
         at java.security.Signature$Delegate.engineVerify(Signature.java:1275)
         at java.security.Signature.verify(Signature.java:719)
  </code></pre>