Package org.opensaml.xmlsec.keyinfo.impl

# Class X509KeyInfoGeneratorFactory

java.lang.Object
org.opensaml.xmlsec.keyinfo.impl.BasicKeyInfoGeneratorFactory
org.opensaml.xmlsec.keyinfo.impl.X509KeyInfoGeneratorFactory

All Implemented Interfaces:
  `KeyInfoGeneratorFactory`

public class X509KeyInfoGeneratorFactory extends BasicKeyInfoGeneratorFactory
A factory implementation which produces instances of `KeyInfoGenerator` capable of handling the information contained within an `X509Credential`. All boolean options default to false. The default implementation of `X500DNHandler` used is `InternalX500DNHandler`. The default output format for subject and issuer DN's is RFC2253. The default set of subject alternative names to process is empty.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`X509KeyInfoGeneratorFactory.X509KeyInfoGenerator`
An implementation of `KeyInfoGenerator` capable of handling the information contained within a `X509Credential`.
`protected class`
`X509KeyInfoGeneratorFactory.X509Options`
Options to be used in the production of a `KeyInfo` from an `X509Credential`.

## Nested classes/interfaces inherited from class org.opensaml.xmlsec.keyinfo.impl.BasicKeyInfoGeneratorFactory

`BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator, BasicKeyInfoGeneratorFactory.BasicOptions`

## Field Summary

Fields
Modifier and Type
Field
Description
`private final X509KeyInfoGeneratorFactory.X509Options`
`options`
The set of options configured for the factory.

## Constructor Summary

Constructors
Constructor
Description
`X509KeyInfoGeneratorFactory()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`emitCRLs()`
Get the option to emit the CRL list as sequence of X509CRL elements within X509Data.
`boolean`
`emitEntityCertificate()`
Get the option to emit the entity certificate as an X509Certificate element within X509Data.
`boolean`
`emitEntityCertificateChain()`
Get the option to emit the entity certificate chain as sequence of X509Certificate elements within X509Data.
`boolean`
`emitSubjectAltNamesAsKeyNames()`
Get the option to emit the entity certificate subject alternative name extension values as KeyName elements.
`boolean`
`emitSubjectCNAsKeyName()`
Get the option to emit the entity certificate subject DN common name (CN) fields as KeyName elements.
`boolean`
`emitSubjectDNAsKeyName()`
Get the option to emit the entity certificate subject DN as a KeyName element.
`boolean`
`emitX509Digest()`
Get the option to emit the entity certificate digest as an X509Digest element within X509Data.
`boolean`
`emitX509IssuerSerial()`
Get the option to emit the entity certificate issuer name and serial number as an X509IssuerSerial element within X509Data.
`boolean`
`emitX509SKI()`
Get the option to emit the entity certificate subject key identifier as an X509SKI element within X509Data.
`boolean`
`emitX509SubjectName()`
Get the option to emit the entity certificate subject DN as an X509SubjectName element within X509Data.
`Class<? extends Credential>`
`getCredentialType()`
Get the type (interface) of the specific type of credential handled by generators produced by this factory.
`protected X509KeyInfoGeneratorFactory.X509Options`
`getOptions()`
Get the options of this instance.
`Set<Integer>`
`getSubjectAltNames()`
The set of types of subject alternative names to process.
`X500DNHandler`
`getX500DNHandler()`
Get the handler which process X.500 distinguished names.
`String`
`getX500IssuerDNFormat()`
Get the output format specifier for X.500 issuer names.
`String`
`getX500SubjectDNFormat()`
Get the output format specifier for X.500 subject names.
`String`
`getX509DigestAlgorithmURI()`
Get the algorithm URI for X509Digest digests.
`boolean`
`handles(Credential credential)`
Check whether the generators produced by this factory can handle the specified credential.
`KeyInfoGenerator`
`newInstance()`
Get a new instance of the generator type produced by the factory.
`KeyInfoGenerator`
`newInstance(Class<? extends KeyInfo> type)`
Get a new instance of the generator type produced by the factory, and which generates `KeyInfo` instances of the specified type, for example `OriginatorKeyInfo` or `RecipientKeyInfo`.
`protected X509KeyInfoGeneratorFactory.X509Options`
`newOptions()`
Get a new instance to hold options.
`void`
`setEmitCRLs(boolean newValue)`
Set the option to emit the CRL list as sequence of X509CRL elements within X509Data.
`void`
`setEmitEntityCertificate(boolean newValue)`
Set the option to emit the entity certificate as an X509Certificate element within X509Data.
`void`
`setEmitEntityCertificateChain(boolean newValue)`
Set the option to emit the entity certificate chain as sequence of X509Certificate elements within X509Data.
`void`
`setEmitSubjectAltNamesAsKeyNames(boolean newValue)`
Set the option to emit the entity certificate subject alternative name extension values as KeyName elements.
`void`
`setEmitSubjectCNAsKeyName(boolean newValue)`
Set the option to emit the entity certificate subject DN common name (CN) fields as KeyName elements.
`void`
`setEmitSubjectDNAsKeyName(boolean newValue)`
Set the option to emit the entity certificate subject DN as a KeyName element.
`void`
`setEmitX509Digest(boolean newValue)`
Set the option to emit the entity certificate digest as an X509Digest element within X509Data.
`void`
`setEmitX509IssuerSerial(boolean newValue)`
Set the option to emit the entity certificate issuer name and serial number as an X509IssuerSerial element within X509Data.
`void`
`setEmitX509SKI(boolean newValue)`
Set the option to emit the entity certificate subject key identifier as an X509SKI element within X509Data.
`void`
`setEmitX509SubjectName(boolean newValue)`
Set the option to emit the entity certificate subject DN as an X509SubjectName element within X509Data.
`void`
`setX500DNHandler(X500DNHandler handler)`
Set the handler which process X.500 distinguished names.
`void`
`setX500IssuerDNFormat(String format)`
Set the output format specifier for X.500 issuer names.
`void`
`setX500SubjectDNFormat(String format)`
Set the output format specifier for X.500 subject names.
`void`
`setX509DigestAlgorithmURI(String alg)`
Set the algorithm URI for X509Digest digests.

### Methods inherited from class org.opensaml.xmlsec.keyinfo.impl.BasicKeyInfoGeneratorFactory

`emitEntityIDAsKeyName, emitKeyNames, emitPublicDEREncodedKeyValue, emitPublicKeyValue, setEmitEntityIDAsKeyName, setEmitKeyNames, setEmitPublicDEREncodedKeyValue, setEmitPublicKeyValue`

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

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

## Field Details

### options

@Nonnull private final X509KeyInfoGeneratorFactory.X509Options options
The set of options configured for the factory.

## Constructor Details

### X509KeyInfoGeneratorFactory

public X509KeyInfoGeneratorFactory()
Constructor.

## Method Details

### getCredentialType

@Nonnull public Class<? extends Credential> getCredentialType()
Get the type (interface) of the specific type of credential handled by generators produced by this factory. Primarily used as an index by manager implementions such as `KeyInfoGeneratorManager`.

Specified by:
  `getCredentialType` in interface `KeyInfoGeneratorFactory`
Overrides:
  `getCredentialType` in class `BasicKeyInfoGeneratorFactory`
Returns:
  the specifc type of credential handled by the generators produced by this factory

### handles

public boolean handles(@Nonnull Credential credential)
Check whether the generators produced by this factory can handle the specified credential.

Specified by:
  `handles` in interface `KeyInfoGeneratorFactory`
Overrides:
  `handles` in class `BasicKeyInfoGeneratorFactory`
Parameters:
  `credential` - the credential to evaluate
Returns:
  true if the generators produced by this factory can handle the type of the specified credential, false otherwise

### newInstance

@Nonnull public KeyInfoGenerator newInstance()
Get a new instance of the generator type produced by the factory.

Specified by:
  `newInstance` in interface `KeyInfoGeneratorFactory`
Overrides:
  `newInstance` in class `BasicKeyInfoGeneratorFactory`
Returns:
  a new KeyInfoGenerator instance

### newInstance

@Nonnull public KeyInfoGenerator newInstance(@Nullable Class<? extends KeyInfo> type)
Get a new instance of the generator type produced by the factory, and which generates `KeyInfo` instances of the specified type, for example `OriginatorKeyInfo` or `RecipientKeyInfo`.

Specified by:
  `newInstance` in interface `KeyInfoGeneratorFactory`
Overrides:
  `newInstance` in class `BasicKeyInfoGeneratorFactory`
Parameters:
  `type` - the type of element to produce. Null is interpreted as a standard `KeyInfo`.
Returns:
  a new KeyInfoGenerator instance

### emitCRLs

public boolean emitCRLs()
Get the option to emit the CRL list as sequence of X509CRL elements within X509Data.

Returns:
  the option value

### setEmitCRLs

public void setEmitCRLs(boolean newValue)
Set the option to emit the CRL list as sequence of X509CRL elements within X509Data.

Parameters:
  `newValue` - the new option value

### emitEntityCertificate

public boolean emitEntityCertificate()
Get the option to emit the entity certificate as an X509Certificate element within X509Data.

Returns:
  the option value

### setEmitEntityCertificate

public void setEmitEntityCertificate(boolean newValue)
Set the option to emit the entity certificate as an X509Certificate element within X509Data.

Parameters:
  `newValue` - the new option value

### emitEntityCertificateChain

public boolean emitEntityCertificateChain()
Get the option to emit the entity certificate chain as sequence of X509Certificate elements within X509Data.

Returns:
  the option value

### setEmitEntityCertificateChain

public void setEmitEntityCertificateChain(boolean newValue)
Set the option to emit the entity certificate chain as sequence of X509Certificate elements within X509Data.

Parameters:
  `newValue` - the new option value

### emitSubjectAltNamesAsKeyNames

public boolean emitSubjectAltNamesAsKeyNames()
Get the option to emit the entity certificate subject alternative name extension values as KeyName elements.

Returns:
  the option value

### setEmitSubjectAltNamesAsKeyNames

public void setEmitSubjectAltNamesAsKeyNames(boolean newValue)
Set the option to emit the entity certificate subject alternative name extension values as KeyName elements.

Parameters:
  `newValue` - the new option value

### emitSubjectCNAsKeyName

public boolean emitSubjectCNAsKeyName()
Get the option to emit the entity certificate subject DN common name (CN) fields as KeyName elements.

Returns:
  the option value

### setEmitSubjectCNAsKeyName

public void setEmitSubjectCNAsKeyName(boolean newValue)
Set the option to emit the entity certificate subject DN common name (CN) fields as KeyName elements.

Parameters:
  `newValue` - the new option value

### emitSubjectDNAsKeyName

public boolean emitSubjectDNAsKeyName()
Get the option to emit the entity certificate subject DN as a KeyName element.

Returns:
  the option value

### setEmitSubjectDNAsKeyName

public void setEmitSubjectDNAsKeyName(boolean newValue)
Set the option to emit the entity certificate subject DN as a KeyName element.

Parameters:
  `newValue` - the new option value

### emitX509IssuerSerial

public boolean emitX509IssuerSerial()
Get the option to emit the entity certificate issuer name and serial number as an X509IssuerSerial element within X509Data.

Returns:
  the option value

### setEmitX509IssuerSerial

public void setEmitX509IssuerSerial(boolean newValue)
Set the option to emit the entity certificate issuer name and serial number as an X509IssuerSerial element within X509Data.

Parameters:
  `newValue` - the new option value

### emitX509SKI

public boolean emitX509SKI()
Get the option to emit the entity certificate subject key identifier as an X509SKI element within X509Data.

Returns:
  the option value

### setEmitX509SKI

public void setEmitX509SKI(boolean newValue)
Set the option to emit the entity certificate subject key identifier as an X509SKI element within X509Data.

Parameters:
  `newValue` - the new option value

### emitX509Digest

public boolean emitX509Digest()
Get the option to emit the entity certificate digest as an X509Digest element within X509Data.

Returns:
  the option value

### setEmitX509Digest

public void setEmitX509Digest(boolean newValue)
Set the option to emit the entity certificate digest as an X509Digest element within X509Data.

Parameters:
  `newValue` - the new option value

### getX509DigestAlgorithmURI

@Nonnull public String getX509DigestAlgorithmURI()
Get the algorithm URI for X509Digest digests. Defaults to SHA-256.

Returns:
  returns the digest algorithm URI

### setX509DigestAlgorithmURI

public void setX509DigestAlgorithmURI(@Nonnull String alg)
Set the algorithm URI for X509Digest digests. Defaults to SHA-256.

Parameters:
  `alg` - the new digest algorithmURI

### emitX509SubjectName

public boolean emitX509SubjectName()
Get the option to emit the entity certificate subject DN as an X509SubjectName element within X509Data.

Returns:
  the option value

### setEmitX509SubjectName

public void setEmitX509SubjectName(boolean newValue)
Set the option to emit the entity certificate subject DN as an X509SubjectName element within X509Data.

Parameters:
  `newValue` - the new option value

### getSubjectAltNames

@Nonnull public Set<Integer> getSubjectAltNames()
The set of types of subject alternative names to process. Name types are represented using the constant OID tag name values defined in `X509Support`.

Returns:
  the modifiable set of alt name identifiers

### getX500DNHandler

@Nonnull public X500DNHandler getX500DNHandler()
Get the handler which process X.500 distinguished names. Defaults to `InternalX500DNHandler`.

Returns:
  returns the X500DNHandler instance

### setX500DNHandler

public void setX500DNHandler(@Nonnull X500DNHandler handler)
Set the handler which process X.500 distinguished names. Defaults to `InternalX500DNHandler`.

Parameters:
  `handler` - the new X500DNHandler instance

### getX500SubjectDNFormat

@Nullable public String getX500SubjectDNFormat()
Get the output format specifier for X.500 subject names. Defaults to RFC2253 format. The meaning of this format specifier value is dependent upon the implementation of `X500DNHandler` which is used.

Returns:
  returns the format specifier

### setX500SubjectDNFormat

public void setX500SubjectDNFormat(@Nullable String format)
Set the output format specifier for X.500 subject names. Defaults to RFC2253 format. The meaning of this format specifier value is dependent upon the implementation of `X500DNHandler` which is used.

Parameters:
  `format` - the new X500DNHandler instance

### getX500IssuerDNFormat

@Nullable public String getX500IssuerDNFormat()
Get the output format specifier for X.500 issuer names. Defaults to RFC2253 format. The meaning of this format specifier value is dependent upon the implementation of `X500DNHandler` which is used.

Returns:
  returns the format specifier

### setX500IssuerDNFormat

public void setX500IssuerDNFormat(@Nullable String format)
Set the output format specifier for X.500 issuer names. Defaults to RFC2253 format. The meaning of this format specifier value is dependent upon the implementation of `X500DNHandler` which is used.

Parameters:
  `format` - the new X500DNHandler instance

### getOptions

@Nonnull protected X509KeyInfoGeneratorFactory.X509Options getOptions()
Get the options of this instance. Used by subclass constructors to get the options built by the top-level class constructor with `BasicKeyInfoGeneratorFactory.newOptions()`.

Overrides:
  `getOptions` in class `BasicKeyInfoGeneratorFactory`
Returns:
  the options instance

### newOptions

@Nonnull protected X509KeyInfoGeneratorFactory.X509Options newOptions()
Get a new instance to hold options. Used by the top-level superclass constructor. Subclasses MUST override to produce an instance of the appropriate subclass of `BasicKeyInfoGeneratorFactory.BasicOptions`.

Overrides:
  `newOptions` in class `BasicKeyInfoGeneratorFactory`
Returns:
  a new instance of factory/generator options