title: How to decrypt a pkcs8 encrypted private key using bouncy castle?
body: <p>i am trying to decrypt a pkcs8 encrypted private key using bouncy castle library. I parsed the file containing the private key using <code>PEMParser</code> provided by bouncy castle. I got <code>PKCS8EncryptedPrivateKeyInfo</code> object. I am unable to get the <code>PrivateKeyInfo</code> object from this.
  I am getting the following exception while trying to decrypt.</p>
  
  <blockquote>
    <p>org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: No such provider: 1.2.840.113549.1.5.13</p>
  </blockquote>
  
  <p>here is the code which I used</p>
  
  <pre><code>PEMParser parser = new PEMParser(br);
  PKCS8EncryptedPrivateKeyInfo pair =       (PKCS8EncryptedPrivateKeyInfo)parser.readObject();
  JceOpenSSLPKCS8DecryptorProviderBuilder jce = new JceOpenSSLPKCS8DecryptorProviderBuilder();
                  jce.setProvider("1.2.840.113549.1.5.13");
                  InputDecryptorProvider decProv = jce.build(password.toCharArray());
                  PrivateKeyInfo info = pair.decryptPrivateKeyInfo(decProv);
  </code></pre>