public class OpenSSHPrivateKeyUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
encodePrivateKey(AsymmetricKeyParameter params)
Encode a cipher parameters into an OpenSSH private key.
|
static AsymmetricKeyParameter |
parsePrivateKeyBlob(byte[] blob)
Parse a private key.
|
public static byte[] encodePrivateKey(AsymmetricKeyParameter params) throws java.io.IOException
params
- the cipher parameters.java.io.IOException
public static AsymmetricKeyParameter parsePrivateKeyBlob(byte[] blob)
This method accepts the body of the OpenSSH private key. The easiest way to extract the body is to use PemReader, for example:
byte[] blob = new PemReader([reader]).readPemObject().getContent(); CipherParameters params = parsePrivateKeyBlob(blob);
blob
- The key.