public final class XMLCipherUtil extends Object
| Constructor and Description |
|---|
XMLCipherUtil() |
| Modifier and Type | Method and Description |
|---|---|
static KeyAgreementParameters |
constructAgreementParameters(String agreementAlgorithmURI,
KeyAgreementParameters.ActorType actorType,
KeyDerivationParameters keyDerivationParameter,
PrivateKey keyAgreementPrivateKey,
PublicKey keyAgreementPublicKey)
Construct an KeyAgreementParameterSpec object from the given parameters
|
static AlgorithmParameterSpec |
constructBlockCipherParameters(boolean gcmAlgorithm,
byte[] iv) |
static AlgorithmParameterSpec |
constructBlockCipherParameters(String algorithm,
byte[] iv)
Build an
AlgorithmParameterSpec instance used to initialize a Cipher instance
for block cipher encryption and decryption. |
static KeyDerivationParameters |
constructKeyDerivationParameter(KeyDerivationMethod keyDerivationMethod,
int keyBitLength)
Construct a KeyDerivationParameter object from the given keyDerivationMethod data
and keyBitLength.
|
static MGF1ParameterSpec |
constructMGF1Parameter(String mgh1AlgorithmURI)
Create MGF1ParameterSpec for the given algorithm URI
|
static OAEPParameterSpec |
constructOAEPParameters(String encryptionAlgorithmURI,
String digestAlgorithmURI,
String mgfAlgorithmURI,
byte[] oaepParams)
Method buildOAEPParameters from given parameters and returns OAEPParameterSpec.
|
static KeyAgreementParameters |
constructRecipientKeyAgreementParameters(String keyWrapAlgoURI,
AgreementMethod agreementMethod,
PrivateKey keyAgreementPrivateKey)
Construct an KeyAgreementParameterSpec object from the given parameters
|
static String |
getMgf1URIForParameter(MGF1ParameterSpec parameterSpec)
Get the MGF1 algorithm URI for the given MGF1ParameterSpec
|
static byte[] |
hexStringToByteArray(String hexString)
Method hexStringToByteArray converts hex string to byte array.
|
public static AlgorithmParameterSpec constructBlockCipherParameters(String algorithm, byte[] iv)
AlgorithmParameterSpec instance used to initialize a Cipher instance
for block cipher encryption and decryption.algorithm - the XML encryption algorithm URIiv - the initialization vectorpublic static AlgorithmParameterSpec constructBlockCipherParameters(boolean gcmAlgorithm, byte[] iv)
public static OAEPParameterSpec constructOAEPParameters(String encryptionAlgorithmURI, String digestAlgorithmURI, String mgfAlgorithmURI, byte[] oaepParams)
encryptionAlgorithmURI - the encryption algorithm URI (RSA_OAEP or RSA_OAEP_11)digestAlgorithmURI - the digest algorithm URImgfAlgorithmURI - the MGF algorithm URI if encryptionAlgorithmURI is RSA_OAEP_11, otherwise parameter is ignoredoaepParams - the OAEP parameters bytespublic static MGF1ParameterSpec constructMGF1Parameter(String mgh1AlgorithmURI)
mgh1AlgorithmURI - the algorithm URI. If null or empty, SHA-1 is used as default MGF1 digest algorithm.public static String getMgf1URIForParameter(MGF1ParameterSpec parameterSpec)
parameterSpec - the MGF1ParameterSpecpublic static KeyAgreementParameters constructRecipientKeyAgreementParameters(String keyWrapAlgoURI, AgreementMethod agreementMethod, PrivateKey keyAgreementPrivateKey) throws XMLSecurityException
keyWrapAlgoURI - key wrap algorithmagreementMethod - agreement methodkeyAgreementPrivateKey - private key to derive the shared secret in case of Diffie-Hellman key agreementsXMLSecurityExceptionpublic static KeyAgreementParameters constructAgreementParameters(String agreementAlgorithmURI, KeyAgreementParameters.ActorType actorType, KeyDerivationParameters keyDerivationParameter, PrivateKey keyAgreementPrivateKey, PublicKey keyAgreementPublicKey)
agreementAlgorithmURI - agreement algorithm URIactorType - the actor type (originator or recipient)keyDerivationParameter - key derivation parameters (e.g. ConcatKDFParams for ConcatKDF key derivation)keyAgreementPrivateKey - private key to derive the shared secret in case of Diffie-Hellman key agreementskeyAgreementPublicKey - public key to derive the shared secret in case of Diffie-Hellman key agreementspublic static KeyDerivationParameters constructKeyDerivationParameter(KeyDerivationMethod keyDerivationMethod, int keyBitLength) throws XMLEncryptionException
keyDerivationMethod - element with the key derivation method datakeyBitLength - expected derived key length in bitsXMLEncryptionException - if KDFParams cannot be created or the
KDF URI is not supported or the key derivation parameters are invalidpublic static byte[] hexStringToByteArray(String hexString)
hexString - the hex string to convertCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.