title: java.security.spec.InvalidKeySpecException: when generate SAML signature
body: <p>I met below error when I use <a href="https://github.com/rackerlabs/saml-generator" rel="nofollow noreferrer">saml generator</a> together with my keystore and certificate, can anyone tell me what goes wrong?</p>
  
  <pre><code>    java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : DerInputStream.getLength(): lengthTag=109, too big.
      at sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(Unknown Source)
      at java.security.KeyFactory.generatePrivate(Unknown Source)
      at com.rackspace.saml.CertManager.getSigningCredential(CertManager.java:43)
      at com.rackspace.saml.SamlAssertionProducer.createSignature(SamlAssertionProducer.java:228)
      at com.rackspace.saml.SamlAssertionProducer.createSAMLResponse(SamlAssertionProducer.java:39)
      at com.rackspace.saml.Client.getSAMLXML(Client.java:186)
      at com.rackspace.saml.Client.main(Client.java:208)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  Caused by: java.security.InvalidKeyException: IOException : DerInputStream.getLength(): lengthTag=109, too big.
      at sun.security.pkcs.PKCS8Key.decode(Unknown Source)
      at sun.security.pkcs.PKCS8Key.decode(Unknown Source)
      at sun.security.rsa.RSAPrivateCrtKeyImpl.&lt;init&gt;(Unknown Source)
      at sun.security.rsa.RSAPrivateCrtKeyImpl.newKey(Unknown Source)
      at sun.security.rsa.RSAKeyFactory.generatePrivate(Unknown Source)
      ... 12 more
  java.lang.NullPointerException
      at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:95)
      at org.opensaml.common.impl.AbstractSAMLObjectMarshaller.marshall(AbstractSAMLObjectMarshaller.java:59)
      at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:85)
      at com.rackspace.saml.Client.getSAMLXML(Client.java:189)
      at com.rackspace.saml.Client.main(Client.java:208)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  </code></pre>