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 Details

  • Constructor Details

    • BasicKeyInfoGenerator

      protected BasicKeyInfoGenerator(@Nonnull BasicKeyInfoGeneratorFactory.BasicOptions newOptions, @Nullable Class<? extends KeyInfo> type)
      Constructor.
      Parameters:
      newOptions - the options to be used by the generator
      type - the type of element to produce
  • Method Details

    • generate

      @Nullable public KeyInfo generate(@Nullable Credential credential) throws SecurityException
      Generate a new KeyInfo object based on keying material and other information within a credential.
      Specified by:
      generate in interface KeyInfoGenerator
      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

      protected KeyInfo buildKeyInfo() throws SecurityException
      Build a new KeyInfo instance.

      The exact element type is determined by keyInfoType which was supplied at factory construction.

      Returns:
      a new KeyInfo instance
      Throws:
      SecurityException - if class type can not be mapped to an element QName
    • classToElementName

      @Nullable protected QName classToElementName(@Nonnull Class<? extends KeyInfo> type)
      Map the specified KeyInfo type to an element QName.

      Subclasses may override to implement new types or custom mappings.

      Parameters:
      type - the KeyInfo element type
      Returns:
      the mapped element name
    • processKeyNames

      protected void processKeyNames(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential)
      Process the values of Credential.getKeyNames().
      Parameters:
      keyInfo - the KeyInfo that is being built
      credential - the Credential that is geing processed
    • processEntityID

      protected void processEntityID(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential)
      Process the value of Credential.getEntityId().
      Parameters:
      keyInfo - the KeyInfo that is being built
      credential - the Credential that is geing processed
    • processPublicKey

      protected void processPublicKey(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential) throws SecurityException
      Process the value of Credential.getPublicKey().
      Parameters:
      keyInfo - the KeyInfo that is being built
      credential - the Credential that is being processed
      Throws:
      SecurityException - if the public key can't be encoded properly