public class OpenSSHPrivateKeyUtil extends 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 IOException
params
- the cipher parameters.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.Copyright © 2021 BouncyCastle.org. All rights reserved.