Class KeyAgreementSupport

java.lang.Object
org.opensaml.xmlsec.agreement.KeyAgreementSupport

public final class KeyAgreementSupport extends Object
Support for key agreement operations.
  • Field Details

    • KEY_ALGORITHMS

      @Nonnull public static final Set<String> KEY_ALGORITHMS
      JCA key algorithms that support key agreement.
  • Constructor Details

    • KeyAgreementSupport

      private KeyAgreementSupport()
      Constructor.
  • Method Details

    • getGlobalProcessorRegistry

      @Nullable public static KeyAgreementProcessorRegistry getGlobalProcessorRegistry()
      Get the global KeyAgreementProcessorRegistry instance.
      Returns:
      the global processor registry, or null if nothing registered
    • ensureGlobalProcessorRegistry

      @Nonnull public static KeyAgreementProcessorRegistry ensureGlobalProcessorRegistry()
      Get the global KeyAgreementProcessorRegistry instance, raising an exception if unavailable.
      Returns:
      the global processor registry
      Since:
      5.0.0
    • getProcessor

      @Nonnull public static KeyAgreementProcessor getProcessor(@Nonnull String algorithm) throws KeyAgreementException
      Lookup and return the KeyAgreementProcessor to use for the specified key agreement algorithm.
      Parameters:
      algorithm - the key agreement algorithm
      Returns:
      the processor for that algorithm
      Throws:
      KeyAgreementException - if global KeyAgreementProcessorRegistry is not configured or if no processor is registered for the specified algorithm
    • getExplicitKeySize

      @Nullable public static Integer getExplicitKeySize(@Nonnull AgreementMethod agreementMethod)
      Look for an explicit key size via an AgreementMethod's grandparent's EncryptionMethod child's KeySize child element.
      Parameters:
      agreementMethod - the AgreementMethod to process
      Returns:
      the key size, or null if not present
    • validateKeyAlgorithmAndSize

      public static void validateKeyAlgorithmAndSize(@Nonnull String algorithmURI, @Nullable Integer specifiedKeyLength) throws KeyAgreementException
      Validate the specified algorithm URI and key length for consistency.

      If the algorithm URI does not imply a key length, then the specified key length must be non-null. If the algorithm URI does imply a key length and the optional specified key length is non-null, they must be the same length.

      Parameters:
      algorithmURI - the algorithm URI
      specifiedKeyLength - the optional specified key length
      Throws:
      KeyAgreementException - if algorithm and specified key lengths are not consistent
    • supportsKeyAgreement

      public static boolean supportsKeyAgreement(@Nullable Credential credential)
      Evaluate whether the specified credential contains a public key which supports key agreement.
      Parameters:
      credential - the credential to evaluate
      Returns:
      true if supports key agreement, false if does not