org.bouncycastle.crypto.util

## Class PrivateKeyFactory

- java.lang.Object
- - org.bouncycastle.crypto.util.PrivateKeyFactory

    public class PrivateKeyFactory
    extends java.lang.Object

Factory for creating private key objects from PKCS8 PrivateKeyInfo objects.

### Constructor Summary

Constructors
Constructor and Description
`PrivateKeyFactory()`

### Method Summary

Methods
`static AsymmetricKeyParameter` `createKey(byte[] privateKeyInfoData)` Create a private key parameter from a PKCS8 PrivateKeyInfo encoding.
`static AsymmetricKeyParameter` `createKey(java.io.InputStream inStr)` Create a private key parameter from a PKCS8 PrivateKeyInfo encoding read from a stream.
`static AsymmetricKeyParameter` `createKey(PrivateKeyInfo keyInfo)` Create a private key parameter from the passed in PKCS8 PrivateKeyInfo object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PrivateKeyFactory

    public PrivateKeyFactory()

### Method Detail

#### createKey

    public static AsymmetricKeyParameter createKey(byte[] privateKeyInfoData)
                                            throws java.io.IOException

Create a private key parameter from a PKCS8 PrivateKeyInfo encoding.

Parameters:
  `privateKeyInfoData` - the PrivateKeyInfo encoding
Returns:
  a suitable private key parameter
Throws:
  `java.io.IOException` - on an error decoding the key

#### createKey

    public static AsymmetricKeyParameter createKey(java.io.InputStream inStr)
                                            throws java.io.IOException

Create a private key parameter from a PKCS8 PrivateKeyInfo encoding read from a stream.

Parameters:
  `inStr` - the stream to read the PrivateKeyInfo encoding from
Returns:
  a suitable private key parameter
Throws:
  `java.io.IOException` - on an error decoding the key

#### createKey

    public static AsymmetricKeyParameter createKey(PrivateKeyInfo keyInfo)
                                            throws java.io.IOException

Create a private key parameter from the passed in PKCS8 PrivateKeyInfo object.

Parameters:
  `keyInfo` - the PrivateKeyInfo object containing the key material
Returns:
  a suitable private key parameter
Throws:
  `java.io.IOException` - on an error decoding the key