title: Exception when Constructing EncryptedPrivateKeyInfo
body: <p>I have generated a private key and encrypted it with a password. Now I want to load it to EncryptedPrivateKeyInfo, so that I can construct and export it into a PEM format file. Below is the code I use,        </p>
  
  <pre><code>final CertAndKeyGen keypair = new CertAndKeyGen("RSA", "SHA1WithRSA", null);
  final X500Name x500Name =
      new X500Name("IN", "AP", "HYD", "TEST", "TEST_ORG", "test@xyz.com");
  keypair.generate(1024);
  final PrivateKey privKey = keypair.getPrivateKey();
  final X509Certificate[] chain = new X509Certificate[1];
  long validity = 123;
  chain[0] = keypair.getSelfCertificate(x500Name, new Date(), 
      validity * 24 * 60 * 60);
  Key key =  new SecretKeySpec(password.getBytes(), ALGO);
  Cipher c = Cipher.getInstance(ALGO);
  c.init(Cipher.ENCRYPT_MODE, key);
  byte[] encVal = c.doFinal(privKey.getEncoded());
  AlgorithmParameters params = AlgorithmParameters.getInstance("DES");
  params.init(encVal); // &lt;--- exception thrown here
  EncryptedPrivateKeyInfo encinfo = new EncryptedPrivateKeyInfo(params, encVal);
  
  // displaying encrypting value
  String encryptedValue = Base64.encodeBase64String(encinfo.getEncoded());
  System.out.println(encryptedValue);
  </code></pre>
  
  <p>But while executing the above code, I get the below exception</p>
  
  <pre><code>java.io.IOException: DER input not an octet string
    at sun.security.util.DerInputStream.getOctetString(DerInputStream.java:233)
    at com.sun.crypto.provider.SunJCE_t.a(DashoA13*..)
    at com.sun.crypto.provider.DESParameters.engineInit(DashoA13*..)
    at java.security.AlgorithmParameters.init(AlgorithmParameters.java:260)
  </code></pre>
  
  <p>in the line <code>params.init(encVal);</code>. I don't get what's going wrong from the exception. Any help or suggestion will be really appreciated. Thanks in advance.</p>