Package org.opensaml.xmlsec.keyinfo.impl
Class BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator
java.lang.Object
org.opensaml.xmlsec.keyinfo.impl.BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator
- All Implemented Interfaces:
KeyInfoGenerator
- Direct Known Subclasses:
KeyAgreementKeyInfoGeneratorFactory.KeyAgreementKeyInfoGenerator,X509KeyInfoGeneratorFactory.X509KeyInfoGenerator
- Enclosing class:
- BasicKeyInfoGeneratorFactory
public class BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator
extends Object
implements KeyInfoGenerator
An implementation of
KeyInfoGenerator capable of handling the information
contained within a Credential.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XMLObjectBuilderFactoryBuilder factory for KeyInfo objects.The specific type of KeyInfo to generate.private final BasicKeyInfoGeneratorFactory.BasicOptionsThe set of options to be used by the generator. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBasicKeyInfoGenerator(BasicKeyInfoGeneratorFactory.BasicOptions newOptions, Class<? extends KeyInfo> type) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyInfoBuild a new KeyInfo instance.protected QNameclassToElementName(Class<? extends KeyInfo> type) Map the specified KeyInfo type to an elementQName.generate(Credential credential) Generate a new KeyInfo object based on keying material and other information within a credential.protected voidprocessEntityID(KeyInfo keyInfo, Credential credential) Process the value ofCredential.getEntityId().protected voidprocessKeyNames(KeyInfo keyInfo, Credential credential) Process the values ofCredential.getKeyNames().protected voidprocessPublicKey(KeyInfo keyInfo, Credential credential) Process the value ofCredential.getPublicKey().
-
Field Details
-
options
The set of options to be used by the generator. -
keyInfoType
The specific type of KeyInfo to generate. -
builderFactory
Builder factory for KeyInfo objects.
-
-
Constructor Details
-
BasicKeyInfoGenerator
protected BasicKeyInfoGenerator(@Nonnull BasicKeyInfoGeneratorFactory.BasicOptions newOptions, @Nullable Class<? extends KeyInfo> type) Constructor.- Parameters:
newOptions- the options to be used by the generatortype- the type of element to produce
-
-
Method Details
-
generate
Generate a new KeyInfo object based on keying material and other information within a credential.- Specified by:
generatein interfaceKeyInfoGenerator- Parameters:
credential- the credential containing keying material and possibly other information- Returns:
- a new KeyInfo object or null if nothing was generated
- Throws:
SecurityException- thrown if there is any error generating the new KeyInfo from the credential
-
buildKeyInfo
Build a new KeyInfo instance.The exact element type is determined by
keyInfoTypewhich was supplied at factory construction.- Returns:
- a new KeyInfo instance
- Throws:
SecurityException- if class type can not be mapped to an elementQName
-
classToElementName
Map the specified KeyInfo type to an elementQName.Subclasses may override to implement new types or custom mappings.
- Parameters:
type- the KeyInfo element type- Returns:
- the mapped element name
-
processKeyNames
Process the values ofCredential.getKeyNames().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is geing processed
-
processEntityID
Process the value ofCredential.getEntityId().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is geing processed
-
processPublicKey
protected void processPublicKey(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential) throws SecurityException Process the value ofCredential.getPublicKey().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is being processed- Throws:
SecurityException- if the public key can't be encoded properly
-