title: Bouncy Castle : PEMReader => PEMParser
body: <p>With a PEM certificate like</p>
  
  <pre><code>-----BEGIN RSA PRIVATE KEY-----
  Proc-Type: 4,ENCRYPTED
  DEK-Info: AES-256-CBC,B9846B5D1803E.....
  </code></pre>
  
  <p>using BC 1.46, I extract the keypair with the following code : </p>
  
  <pre><code>int myFunc(String pemString, char [] password) {
  
      ByteArrayInputStream tube = new ByteArrayInputStream(pemString.getBytes());
  
      Reader fRd = new BufferedReader(new InputStreamReader(tube));
  
      PEMReader pr = new PEMReader(fRd, new Password (password), "BC");
  
       try {
              Object o = pr.readObject();
              if (o instanceof KeyPair)
      .....
  </code></pre>
  
  <p>Now I just installed BC 1.48, and they tell me that PEMReader is deprecated and must be replaced by PEMParser.</p>
  
  <p>My problem is, AFAIK, there is no place for a password in PEMParser.</p>
  
  <p>Could someone give me an example how to migrate my code to a PEMParser version ?</p>