code: public SshKeyPair toKeyPair(String passphrase) throws IOException,
  			InvalidPassphraseException {
  
  		ByteArrayReader bar = new ByteArrayReader(decryptKey(passphrase));
  
  		try {
  			// Process the actual key and return the key pair
  
  			String algorithm = bar.readString();
  
  			if (algorithm.equals("ssh-dss")) {
  				BigInteger p = bar.readBigInteger();
  				BigInteger q = bar.readBigInteger();
  				BigInteger g = bar.readBigInteger();
  				BigInteger x = bar.readBigInteger();
  
  				SshDsaPrivateKey prv = ComponentManager.getInstance()
  						.createDsaPrivateKey(p, q, g, x, g.modPow(x, p));
  				SshKeyPair pair = new SshKeyPair();
  
  				pair.setPublicKey(prv.getPublicKey());
  				pair.setPrivateKey(ComponentManager.getInstance()
  						.createDsaPrivateKey(p, q, g, x, g.modPow(x, p)));
  
  				return pair;
  
  			} else if (algorithm.equals("ssh-rsa")) {
  
  				BigInteger publicExponent = bar.readBigInteger();
  				BigInteger modulus = bar.readBigInteger();
  
  				// Read the private key
  				BigInteger privateExponent = bar.readBigInteger();
  
  				SshKeyPair pair = new SshKeyPair();
  				pair.setPublicKey(ComponentManager.getInstance()
  						.createRsaPublicKey(modulus, publicExponent));
  				pair.setPrivateKey(ComponentManager.getInstance()
  						.createRsaPrivateKey(modulus, privateExponent));
  
  				return pair;
  
  			} else {
  				throw new IOException("Unsupported private key algorithm type "
  						+ algorithm);
  			}
  		} catch (SshException e) {
  			throw new SshIOException(e);
  		} finally {
  			try {
  				bar.close();
  			} catch (IOException e) {
  			}
  		}
  
  	}
docs: /*
  (non-Javadoc)
  
  @see
  com.sshtools.publickey.SshPrivateKeyFile#toPrivateKey(java.lang.String)