Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.crypto.util
Class OpenSSHPrivateKeyUtil

    java.lang.Object
      org.bouncycastle.crypto.util.OpenSSHPrivateKeyUtil

public class OpenSSHPrivateKeyUtil
extends java.lang.Object

A collection of utility methods for parsing OpenSSH private keys.

Method Summary
`static byte[]` | `encodePrivateKey(AsymmetricKeyParameter params)` Encode a cipher parameters into an OpenSSH private key.
`static AsymmetricKeyParameter` | `parsePrivateKeyBlob(byte[] blob)` Parse a private key.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### encodePrivateKey

    public static byte[] encodePrivateKey(AsymmetricKeyParameter params)
                                   throws java.io.IOException

  Encode a cipher parameters into an OpenSSH private key. This does not add headers like ----BEGIN RSA PRIVATE KEY----

  Parameters:
    `params` - the cipher parameters.
  Returns:
    a byte array
  Throws:
    `java.io.IOException`

### parsePrivateKeyBlob

    public static AsymmetricKeyParameter parsePrivateKeyBlob(byte[] blob)

  Parse a private key.

  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);

  Parameters:
    `blob` - The key.
  Returns:
    A cipher parameters instance.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD