title: Convert PKCS#1-formatted private key to PKCS#8-formatted private key by java
body: <p>I have a PKCS#1-formatted private key (generated by opendkim-genkey) like this</p>
  
  <pre><code>-----BEGIN RSA PRIVATE KEY-----
  
  Base64 encoded data
  
  -----END RSA PRIVATE KEY-----
  </code></pre>
  
  <p>Now I have to use it in Java to generate java.security.PrivateKey</p>
  
  <p>But Java only support PKCS#8-formatted private key.</p>
  
  <p>I know there is a way to convert from PKCS#8 to PKCS#1 by Java (using Bouncycastle), but is there anyway convert from PKCS#1 to PKCS#8 by Java?</p>