Package org.opensaml.xmlsec.agreement
Class KeyAgreementSupport
java.lang.Object
org.opensaml.xmlsec.agreement.KeyAgreementSupport
Support for key agreement operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionJCA key algorithms that support key agreement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the globalKeyAgreementProcessorRegistryinstance, raising an exception if unavailable.static IntegergetExplicitKeySize(AgreementMethod agreementMethod) Look for an explicit key size via anAgreementMethod's grandparent'sEncryptionMethodchild'sKeySizechild element.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.
-
Field Details
-
KEY_ALGORITHMS
JCA key algorithms that support key agreement.
-
-
Constructor Details
-
KeyAgreementSupport
private KeyAgreementSupport()Constructor.
-
-
Method Details
-
getGlobalProcessorRegistry
Get the globalKeyAgreementProcessorRegistryinstance.- Returns:
- the global processor registry, or null if nothing registered
-
ensureGlobalProcessorRegistry
Get the globalKeyAgreementProcessorRegistryinstance, 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 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
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 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 URIspecifiedKeyLength- the optional specified key length- Throws:
KeyAgreementException- if algorithm and specified key lengths are not consistent
-
supportsKeyAgreement
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
-