Class EncryptionMethodMetadata
java.lang.Object
se.swedenconnect.security.credential.opensaml.EncryptionMethodMetadata
Settings for representing
md:EncryptionMethod elements.
When represented in properties files as the value for the OpenSamlMetadataProperties.ENCRYPTION_METHODS
metadata property, a string format according to the following format is used:
<encryption-algorithm-uri>[;key-size=<size-in-bits>][;oaep-params=<base64-params>][;digest-method=<digest-method-uri>]
Example:
<md:EncryptionMethod xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
<ds:DigestMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
</md:EncryptionMethod>
"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p;digest-method=http://www.w3.org/2000/09/xmldsig#sha1"
- Author:
- Martin Lindström
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the algorithm URI for the encryption method.Gets the digest algorithm to use.Gets the key size (relevant if the encryption method is a symmetric algorithm).Gets the OAEP parameters (base64-encoded).static EncryptionMethodMetadataparseMethod(String method) Parses the string representation of an encryption method (seeclass documentation above) into anEncryptionMethodMetadataobject.static List<EncryptionMethodMetadata> parseMethods(String methods) Parses a string representation of several encryption methods.voidsetAlgorithm(String algorithm) Assigns the algorithm URI for the encryption method.voidsetDigestMethod(String digestMethod) Assigns the digest algorithm to use.voidsetKeySize(Integer keySize) Assigns the key size.voidsetOaepParams(String oaepParams) Assigns the OAEP parameters (base64-encoded).Creates an OpenSAMLEncryptionMethodobject given the settings of this object.toString()
-
Field Details
-
KEY_SIZE_PREFIX
- See Also:
-
OAEP_PARAMS_PREFIX
- See Also:
-
DIGEST_METHOD_PREFIX
- See Also:
-
-
Constructor Details
-
EncryptionMethodMetadata
public EncryptionMethodMetadata()
-
-
Method Details
-
getAlgorithm
Gets the algorithm URI for the encryption method.- Returns:
- the algorithm URI for the encryption method
-
setAlgorithm
Assigns the algorithm URI for the encryption method.- Parameters:
algorithm- the algorithm URI
-
getKeySize
Gets the key size (relevant if the encryption method is a symmetric algorithm).- Returns:
- the key size in bits, or
null
-
setKeySize
Assigns the key size.- Parameters:
keySize- the key size in bits
-
getOaepParams
Gets the OAEP parameters (base64-encoded).- Returns:
- the OAEP parameters or
null
-
setOaepParams
Assigns the OAEP parameters (base64-encoded).- Parameters:
oaepParams- the OAEP parameters
-
getDigestMethod
Gets the digest algorithm to use. Relevant if the encryption method ishttp://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1porhttp://www.w3.org/2009/xmlenc11#rsa-oaep.- Returns:
- the digest method, or
null
-
setDigestMethod
Assigns the digest algorithm to use. Relevant if the encryption method ishttp://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1porhttp://www.w3.org/2009/xmlenc11#rsa-oaep.- Parameters:
digestMethod- the digest method
-
parseMethod
@Nonnull public static EncryptionMethodMetadata parseMethod(@Nonnull String method) throws IllegalArgumentException Parses the string representation of an encryption method (seeclass documentation above) into anEncryptionMethodMetadataobject.- Parameters:
method- the string representation- Returns:
- an
EncryptionMethodMetadataobject - Throws:
IllegalArgumentException- for invalid indata
-
parseMethods
@Nonnull public static List<EncryptionMethodMetadata> parseMethods(@Nonnull String methods) throws IllegalArgumentException Parses a string representation of several encryption methods. Each method is separated by a ','. SeeparseMethod(String).- Parameters:
methods- the string representation- Returns:
- a list of
EncryptionMethodMetadataobjects - Throws:
IllegalArgumentException- for invalid indate
-
toEncryptionMethod
Creates an OpenSAMLEncryptionMethodobject given the settings of this object.- Returns:
- an OpenSAML
EncryptionMethodobject
-
toString
-