Class SimpleEncryptionTest


  • public class SimpleEncryptionTest
    extends org.opensaml.core.xml.XMLObjectBaseTestCase
    Simple tests for encryption.
    • Field Detail

      • encrypter

        private org.opensaml.xmlsec.encryption.support.Encrypter encrypter
      • encParams

        private org.opensaml.xmlsec.encryption.support.DataEncryptionParameters encParams
      • algoURI

        private String algoURI
      • kekParamsList

        private List<org.opensaml.xmlsec.encryption.support.KeyEncryptionParameters> kekParamsList
      • kekParamsAES

        private org.opensaml.xmlsec.encryption.support.KeyEncryptionParameters kekParamsAES
      • kekURIAES

        private String kekURIAES
      • kekParamsRSA

        private org.opensaml.xmlsec.encryption.support.KeyEncryptionParameters kekParamsRSA
      • kekURIRSA

        private String kekURIRSA
      • keyInfo

        private org.opensaml.xmlsec.signature.KeyInfo keyInfo
      • kekKeyInfoAES

        private org.opensaml.xmlsec.signature.KeyInfo kekKeyInfoAES
      • kekKeyInfoRSA

        private org.opensaml.xmlsec.signature.KeyInfo kekKeyInfoRSA
      • expectedKeyName

        private String expectedKeyName
      • expectedKEKKeyNameAES

        private String expectedKEKKeyNameAES
      • expectedKEKKeyNameRSA

        private String expectedKEKKeyNameRSA
      • expectedRecipientRSA

        private String expectedRecipientRSA
      • expectedRecipientAES

        private String expectedRecipientAES
      • targetFile

        private String targetFile
      • providerSupport

        private org.opensaml.security.SecurityProviderTestSupport providerSupport
    • Constructor Detail

      • SimpleEncryptionTest

        public SimpleEncryptionTest()
        Constructor.
    • Method Detail

      • 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.
      • 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,
                                                       net.shibboleth.utilities.java.support.xml.XMLParserException,
                                                       KeyException
        Test 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 provider
        NoSuchAlgorithmException - bad JCA algorithm
        net.shibboleth.utilities.java.support.xml.XMLParserException - error creating new Document from pool
        KeyException - ...
      • testEncryptKeyDigestMethodsRSAv15

        public void testEncryptKeyDigestMethodsRSAv15()
                                               throws NoSuchAlgorithmException,
                                                      NoSuchProviderException,
                                                      net.shibboleth.utilities.java.support.xml.XMLParserException,
                                                      KeyException
        Test 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 provider
        NoSuchAlgorithmException - bad JCA algorithm
        net.shibboleth.utilities.java.support.xml.XMLParserException - error creating new Document from pool
        KeyException - ...
      • testRSAOAEPParameters

        public void testRSAOAEPParameters()
                                   throws NoSuchAlgorithmException,
                                          NoSuchProviderException,
                                          net.shibboleth.utilities.java.support.xml.XMLParserException,
                                          KeyException,
                                          org.opensaml.xmlsec.encryption.support.EncryptionException
        Test encryption of a symmetric key into an EncryptedKey, using various RSAOAEPParameters options.
        Throws:
        NoSuchProviderException - bad JCA provider
        NoSuchAlgorithmException - bad JCA algorithm
        net.shibboleth.utilities.java.support.xml.XMLParserException - error creating new Document from pool
        KeyException - ...
        org.opensaml.xmlsec.encryption.support.EncryptionException - ...
      • checkKEKAES

        private void checkKEKAES​(org.opensaml.xmlsec.encryption.EncryptedKey encKey,
                                 boolean hasKeyInfo)
        Helper method to test AES KEK.
        Parameters:
        encKey - EncryptedKey to test
        hasKeyInfo - flag indicating expectation of KeyInfo presence
      • checkKEKRSA

        private void checkKEKRSA​(org.opensaml.xmlsec.encryption.EncryptedKey encKey,
                                 boolean hasKeyInfo)
        Helper method to test RSA KEK.
        Parameters:
        encKey - EncryptedKey to test
        hasKeyInfo - flag indicating expectation of KeyInfo presence
      • getDigestMethod

        private String getDigestMethod​(org.opensaml.xmlsec.encryption.EncryptedKey encryptedKey)
      • getMGF

        private String getMGF​(org.opensaml.xmlsec.encryption.EncryptedKey encryptedKey)
      • getOAEPParams

        private String getOAEPParams​(org.opensaml.xmlsec.encryption.EncryptedKey encryptedKey)