Package net.shibboleth.shared.spring.security.factory

# Class PrivateKeyFactoryBean

java.lang.Object
net.shibboleth.shared.spring.security.factory.PrivateKeyFactoryBean

All Implemented Interfaces:
  `FactoryBean<PrivateKey>`

public class PrivateKeyFactoryBean extends Object implements FactoryBean<PrivateKey>
Spring bean factory for producing a `PrivateKey` from a `Resource`. This factory bean supports encrypted and non-encrypted PKCS8, DER, or PEM private key encoded resources.

## Field Summary

Fields
Modifier and Type
Field
Description
`private PrivateKey`
`key`
The singleton instance of the private key produced by this factory.
`private String`
`keyPass`
Password for the private key.
`private Resource`
`resource`
Private key resource.

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`PrivateKeyFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`PrivateKey`
`getObject()`
`Class<?>`
`getObjectType()`
`boolean`
`isSingleton()`
`void`
`setPrivateKeyPassword(String password)`
Sets the password for the private key.
`void`
`setResource(Resource res)`
Sets the resource containing the private key.

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

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

## Field Details

### resource

@Nullable private Resource resource
Private key resource.

### keyPass

private String keyPass
Password for the private key.

### key

private PrivateKey key
The singleton instance of the private key produced by this factory.

## Constructor Details

### PrivateKeyFactoryBean

public PrivateKeyFactoryBean()

## Method Details

### setResource

public void setResource(@Nullable Resource res)
Sets the resource containing the private key.

Parameters:
  `res` - private key resource, never `null`

### setPrivateKeyPassword

public void setPrivateKeyPassword(@Nullable String password)
Sets the password for the private key.

Parameters:
  `password` - password for the private key, may be null if the key is not encrypted

### getObject

public PrivateKey getObject() throws Exception

Specified by:
  `getObject` in interface `FactoryBean<PrivateKey>`
Throws:
  `Exception`

### getObjectType

@Nonnull public Class<?> getObjectType()

Specified by:
  `getObjectType` in interface `FactoryBean<PrivateKey>`

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `FactoryBean<PrivateKey>`