Package com.helger.phase4.crypto
Class AS4CryptParams
java.lang.Object
com.helger.phase4.crypto.AS4CryptParams
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<AS4CryptParams>,Serializable
@NotThreadSafe
public class AS4CryptParams
extends Object
implements Serializable, com.helger.commons.lang.ICloneable<AS4CryptParams>
AS4 encrypt/decrypt parameters
- Since:
- 0.9.0
- Author:
- Philip Helger
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final ECryptoKeyIdentifierTypestatic final String -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using defaultsetKeyIdentifierType(ECryptoKeyIdentifierType),setKeyEncAlgorithm(String),setMGFAlgorithm(String)andsetDigestAlgorithm(String) -
Method Summary
Modifier and TypeMethodDescriptionstatic AS4CryptParamsfinal ECryptoAlgorithmCryptfinal StringgetAlias()final X509CertificategetClone()final Stringfinal Stringfinal ECryptoKeyIdentifierTypefinal Stringfinal booleanhasAlias()final booleanbooleanisCryptEnabled(Consumer<String> aWarningConsumer) final AS4CryptParamssetAlgorithmCrypt(ECryptoAlgorithmCrypt eAlgorithmCrypt) A encryption algorithm can be set.final AS4CryptParamsfinal AS4CryptParamssetCertificate(X509Certificate aCert) Set the X509 certificate be used.final AS4CryptParamssetDigestAlgorithm(String sDigestAlgorithm) Set the digest algorithm to use with the RSA-OAEP key transport algorithm.final AS4CryptParamssetFromPMode(PModeLegSecurity aSecurity) This method callssetAlgorithmCrypt(ECryptoAlgorithmCrypt)based on the PMode parameters.final AS4CryptParamssetKeyEncAlgorithm(String sKeyEncAlgorithm) final AS4CryptParamssetKeyIdentifierType(ECryptoKeyIdentifierType eKeyIdentifierType) Set the key identifier type to use.final AS4CryptParamssetMGFAlgorithm(String sMGFAlgorithm) Set the mask generation function (MGF) algorithm to use with the RSA-OAEP key transport algorithm.toString()
-
Field Details
-
DEFAULT_KEY_IDENTIFIER_TYPE
-
DEFAULT_KEY_ENC_ALGORITHM
- See Also:
-
DEFAULT_MGF_ALGORITHM
- See Also:
-
DEFAULT_DIGEST_ALGORITHM
- See Also:
-
-
Constructor Details
-
AS4CryptParams
public AS4CryptParams()Default constructor using defaultsetKeyIdentifierType(ECryptoKeyIdentifierType),setKeyEncAlgorithm(String),setMGFAlgorithm(String)andsetDigestAlgorithm(String)
-
-
Method Details
-
isCryptEnabled
-
getKeyIdentifierType
- Returns:
- The key identifier type. May not be
null. - Since:
- 0.11.0
-
setKeyIdentifierType
@Nonnull public final AS4CryptParams setKeyIdentifierType(@Nonnull ECryptoKeyIdentifierType eKeyIdentifierType) Set the key identifier type to use. That defines how the information about the signing certificate is transmitted.- Parameters:
eKeyIdentifierType- The key identifier type to use. May not benull.- Returns:
- this for chaining
- Since:
- 0.11.0
-
getAlgorithmCrypt
- Returns:
- The encryption algorithm to use. May be
null.
-
setAlgorithmCrypt
@Nonnull public final AS4CryptParams setAlgorithmCrypt(@Nullable ECryptoAlgorithmCrypt eAlgorithmCrypt) A encryption algorithm can be set.
MANDATORY if you want to use encryption.- Parameters:
eAlgorithmCrypt- the encryption algorithm that should be set- Returns:
- this for chaining
-
getKeyEncAlgorithm
-
setKeyEncAlgorithm
-
getMGFAlgorithm
- Returns:
- The mask generation function (MGF) algorithm to use with the
RSA-OAEP key transport algorithm. The default is
DEFAULT_MGF_ALGORITHM
-
setMGFAlgorithm
Set the mask generation function (MGF) algorithm to use with the RSA-OAEP key transport algorithm.- Parameters:
sMGFAlgorithm- The MFG algorithm to use. May neither benullnor empty.- Returns:
- this for chaining
-
getDigestAlgorithm
- Returns:
- The digest algorithm to use with the RSA-OAEP key transport
algorithm. The default is
DEFAULT_DIGEST_ALGORITHM
-
setDigestAlgorithm
Set the digest algorithm to use with the RSA-OAEP key transport algorithm.- Parameters:
sDigestAlgorithm- The digest algorithm to use. May neither benullnor empty.- Returns:
- this for chaining
-
getCertificate
- Returns:
- The currently set X509 certificate. May be
null.
-
hasCertificate
public final boolean hasCertificate()- Returns:
trueif an X509 certificate is present,falseif not.
-
setCertificate
Set the X509 certificate be used. The provided certificate is not checked for validity. If it is expired only a warning is logged but the certificate will still be used.- Parameters:
aCert- The certificate to be used. May benull.- Returns:
- this for chaining
-
getAlias
-
hasAlias
public final boolean hasAlias() -
setAlias
-
setFromPMode
This method callssetAlgorithmCrypt(ECryptoAlgorithmCrypt)based on the PMode parameters. If the PMode parameter isnullthe value will be set tonull.- Parameters:
aSecurity- The PMode security stuff to use. May benull.- Returns:
- this for chaining
-
getClone
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<AS4CryptParams>
-
toString
-
createDefault
- Returns:
- A non-
nulldefault instance. - See Also:
-