Class SimpleEncryptionTest
java.lang.Object
org.opensaml.core.testing.OpenSAMLInitBaseTestCase
org.opensaml.core.testing.XMLObjectBaseTestCase
org.opensaml.xmlsec.encryption.support.tests.SimpleEncryptionTest
public class SimpleEncryptionTest
extends org.opensaml.core.testing.XMLObjectBaseTestCase
Simple tests for encryption.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate DataEncryptionParametersprivate Encrypterprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringprivate KeyInfoprivate KeyInfoprivate KeyEncryptionParametersprivate List<KeyEncryptionParameters>private KeyEncryptionParametersprivate Stringprivate Stringprivate KeyInfoprivate org.opensaml.security.testing.SecurityProviderTestSupportprivate StringFields inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
builderFactory, marshallerFactory, parserPool, simpleXMLObjectQName, unmarshallerFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckKEKAES(EncryptedKey encKey, boolean hasKeyInfo) Helper method to test AES KEK.private voidcheckKEKRSA(EncryptedKey encKey, boolean hasKeyInfo) Helper method to test RSA KEK.private StringgetDigestMethod(EncryptedKey encryptedKey) private StringgetMGF(EncryptedKey encryptedKey) private StringgetOAEPParams(EncryptedKey encryptedKey) protected voidsetUp()voidTest basic encryption with auto-generated symmetric key.voidTest failure with auto-generated symmetric key and no KEK(s).voidTest basic encryption with symmetric key, one KEK.voidTest basic content encryption with symmetric key, one KEK.voidTest basic content encryption with symmetric key, no key wrap, set key name in passed KeyInfo object.voidTest proper error handling of attempt to encrypt with a DSA key.voidTest basic data encryption with symmetric key, one KEK.voidTest data basic encryption with symmetric key, one KEK.voidTest data basic encryption with symmetric key, no key wrap, set key name in passed KeyInfo object.voidTest code for the Apache XML-Security issue workaround that requires we expliclty express SHA-1 DigestMethod on EncryptionMethod, only when key transport algorithm is RSA-OAEP.voidTest code for the Apache XML-Security issue workaround that requires we expliclty express SHA-1 DigestMethod on EncryptionMethod, only when key transport algorithm is RSA-OAEP.voidTest basic encryption of a symmetric key into an EncryptedKey, set key encrypting key name in passed KeyInfo object.voidTest basic encryption of a symmetric key into an EncryptedKey, set key encrypting key name in passed KeyInfo object.voidTest encryption of a symmetric key into an EncryptedKey, using various RSAOAEPParameters options.Methods inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
assertXMLEquals, assertXMLEquals, buildXMLObject, getBuilder, getMarshaller, getMarshaller, getUnmarshaller, getUnmarshaller, getUnmarshaller, initXMLObjectSupport, parseXMLDocument, printXML, printXML, unmarshallElement, unmarshallElementMethods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase
initOpenSAML
-
Field Details
-
encrypter
-
encParams
-
algoURI
-
kekParamsList
-
kekParamsAES
-
kekURIAES
-
kekParamsRSA
-
kekURIRSA
-
keyInfo
-
kekKeyInfoAES
-
kekKeyInfoRSA
-
expectedKeyName
-
expectedKEKKeyNameAES
-
expectedKEKKeyNameRSA
-
expectedRecipientRSA
-
expectedRecipientAES
-
targetFile
-
providerSupport
private org.opensaml.security.testing.SecurityProviderTestSupport providerSupport
-
-
Constructor Details
-
SimpleEncryptionTest
public SimpleEncryptionTest()Constructor.
-
-
Method Details
-
setUp
- Throws:
Exception
-
testEncryptDataWithKeyNameNoKEK
public void testEncryptDataWithKeyNameNoKEK()Test data basic encryption with symmetric key, no key wrap, set key name in passed KeyInfo object. -
testEncryptDataSingleKEK
public void testEncryptDataSingleKEK()Test data basic encryption with symmetric key, one KEK. -
testEncryptDataMultipleKEK
public void testEncryptDataMultipleKEK()Test basic data encryption with symmetric key, one KEK. -
testEncryptContentWithKeyNameNoKEK
public void testEncryptContentWithKeyNameNoKEK()Test basic content encryption with symmetric key, no key wrap, set key name in passed KeyInfo object. -
testEncryptContentSingleKEK
public void testEncryptContentSingleKEK()Test basic content encryption with symmetric key, one KEK. -
testEncryptContentMultipleKEK
public void testEncryptContentMultipleKEK()Test basic encryption with symmetric key, one KEK. -
testEncryptKeySingleKEK
public void testEncryptKeySingleKEK() throws NoSuchAlgorithmException, NoSuchProviderException, XMLParserException, KeyExceptionTest basic encryption of a symmetric key into an EncryptedKey, set key encrypting key name in passed KeyInfo object.- Throws:
NoSuchProviderException- bad JCA providerNoSuchAlgorithmException- bad JCA algorithmXMLParserException- error creating new Document from poolKeyException- ...
-
testEncryptKeyMultipleKEK
public void testEncryptKeyMultipleKEK() throws NoSuchAlgorithmException, NoSuchProviderException, XMLParserException, KeyExceptionTest basic encryption of a symmetric key into an EncryptedKey, set key encrypting key name in passed KeyInfo object.- Throws:
NoSuchProviderException- bad JCA providerNoSuchAlgorithmException- bad JCA algorithmXMLParserException- error creating new Document from poolKeyException- ...
-
testAutoKeyGen
public void testAutoKeyGen()Test basic encryption with auto-generated symmetric key. -
testAutoKeyGenNoKEK
public void testAutoKeyGenNoKEK()Test failure with auto-generated symmetric key and no KEK(s). -
testEncryptKeyDigestMethodsRSAOAEP
public void testEncryptKeyDigestMethodsRSAOAEP() throws NoSuchAlgorithmException, NoSuchProviderException, XMLParserException, KeyExceptionTest code for the Apache XML-Security issue workaround that requires we expliclty express SHA-1 DigestMethod on EncryptionMethod, only when key transport algorithm is RSA-OAEP.- Throws:
NoSuchProviderException- bad JCA providerNoSuchAlgorithmException- bad JCA algorithmXMLParserException- error creating new Document from poolKeyException- ...
-
testEncryptKeyDigestMethodsRSAv15
public void testEncryptKeyDigestMethodsRSAv15() throws NoSuchAlgorithmException, NoSuchProviderException, XMLParserException, KeyExceptionTest code for the Apache XML-Security issue workaround that requires we expliclty express SHA-1 DigestMethod on EncryptionMethod, only when key transport algorithm is RSA-OAEP.- Throws:
NoSuchProviderException- bad JCA providerNoSuchAlgorithmException- bad JCA algorithmXMLParserException- error creating new Document from poolKeyException- ...
-
testEncryptDataBadKEKDSA
Test proper error handling of attempt to encrypt with a DSA key.- Throws:
NoSuchProviderException- ...NoSuchAlgorithmException- ...
-
testRSAOAEPParameters
public void testRSAOAEPParameters() throws NoSuchAlgorithmException, NoSuchProviderException, XMLParserException, KeyException, EncryptionExceptionTest encryption of a symmetric key into an EncryptedKey, using various RSAOAEPParameters options.- Throws:
NoSuchProviderException- bad JCA providerNoSuchAlgorithmException- bad JCA algorithmXMLParserException- error creating new Document from poolKeyException- ...EncryptionException- ...
-
checkKEKAES
Helper method to test AES KEK.- Parameters:
encKey- EncryptedKey to testhasKeyInfo- flag indicating expectation of KeyInfo presence
-
checkKEKRSA
Helper method to test RSA KEK.- Parameters:
encKey- EncryptedKey to testhasKeyInfo- flag indicating expectation of KeyInfo presence
-
getDigestMethod
-
getMGF
-
getOAEPParams
-