Package org.opensaml.xmlsec.agreement
Class KeyAgreementSupport
- java.lang.Object
-
- org.opensaml.xmlsec.agreement.KeyAgreementSupport
-
public final class KeyAgreementSupport extends Object
Support for key agreement operations.
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>KEY_ALGORITHMSJCA key algorithms that support key agreement.
-
Constructor Summary
Constructors Modifier Constructor Description privateKeyAgreementSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IntegergetExplicitKeySize(AgreementMethod agreementMethod)Look for an explicit key size via anAgreementMethod's grandparent'sEncryptionMethodchild'sKeySizechild element.static KeyAgreementProcessorRegistrygetGlobalProcessorRegistry()Get the globalKeyAgreementProcessorRegistryinstance.static KeyAgreementProcessorgetProcessor(String algorithm)Lookup and return theKeyAgreementProcessorto use for the specified key agreement algorithm.static booleansupportsKeyAgreement(Credential credential)Evaluate whether the specified credential contains a public key which supports key agreement.static voidvalidateKeyAlgorithmAndSize(String algorithmURI, Integer specifiedKeyLength)Validate the specified algorithm URI and key length for consistency.
-
-
-
Method Detail
-
getGlobalProcessorRegistry
@Nullable public static KeyAgreementProcessorRegistry getGlobalProcessorRegistry()
Get the globalKeyAgreementProcessorRegistryinstance.- Returns:
- the global processor registry, or null if nothing registered
-
getProcessor
@Nonnull public static KeyAgreementProcessor getProcessor(@Nonnull String algorithm) throws KeyAgreementException
Lookup and return theKeyAgreementProcessorto use for the specified key agreement algorithm.- Parameters:
algorithm- the key agreement algorithm- Returns:
- the processor for that algorithm
- Throws:
KeyAgreementException- if globalKeyAgreementProcessorRegistryis 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 anAgreementMethod's grandparent'sEncryptionMethodchild'sKeySizechild 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 KeyAgreementExceptionValidate 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 URIspecifiedKeyLength- 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
-
-