org.apache.ws.security.message
Class EncryptionTest

java.lang.Object
  extended by org.junit.Assert
      extended by org.apache.ws.security.message.EncryptionTest

public class EncryptionTest
extends org.junit.Assert

A set of test-cases for encrypting and decrypting SOAP requests.

Author:
Davanum Srinivas (dims@yahoo.com), Werner Dittmann (werner@apache.org)

Constructor Summary
EncryptionTest()
           
 
Method Summary
 void setUp()
          Setup method
 void testBadAttribute()
           
 void testEmbeddedEncryptedKey()
          In this test an EncryptedKey structure is embedded in the EncryptedData structure.
 void testEncryptionDecryptionOAEP()
          Test that encrypt and decrypt a WS-Security envelope.
 void testEncryptionDecryptionOAEPSHA256()
          Test that encrypt and decrypt a WS-Security envelope.
 void testEncryptionDecryptionRSA15()
          Test that encrypt and decrypt a WS-Security envelope.
 void testEncryptionDecryptionRSA15STR()
          Test that encrypt and decrypt a WS-Security envelope.
 void testEncryptionEncryption()
          Test that encrypt and then again encrypts (Super encryption) WS-Security envelope and then verifies it

 void testEncryptionSHA1Symmetric()
          Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key, rather than a generated session key which is then encrypted using a public key.
 void testEncryptionSHA1SymmetricBytes()
          Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key (bytes), rather than a generated session key which is then encrypted using a public key.
 void testEncryptionSHA1SymmetricBytesHandler()
          Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key, rather than a generated session key which is then encrypted using a public key.
 void testX509EncryptionSHA1()
          Test that encrypts and decrypts a WS-Security envelope.
 void testX509EncryptionThumb()
          Test that encrypts and decrypts a WS-Security envelope.
 
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptionTest

public EncryptionTest()
               throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Setup method

Throws:
java.lang.Exception - Thrown when there is a problem in setup

testEncryptionDecryptionRSA15

public void testEncryptionDecryptionRSA15()
                                   throws java.lang.Exception
Test that encrypt and decrypt a WS-Security envelope. This test uses the RSA_15 algorithm to transport (wrap) the symmetric key.

Throws:
java.lang.Exception - Thrown when there is any problem in signing or verification

testEncryptionDecryptionOAEP

public void testEncryptionDecryptionOAEP()
                                  throws java.lang.Exception
Test that encrypt and decrypt a WS-Security envelope. This test uses the RSA OAEP algorithm to transport (wrap) the symmetric key.

Throws:
java.lang.Exception - Thrown when there is any problem in signing or verification

testEncryptionEncryption

public void testEncryptionEncryption()
                              throws java.lang.Exception
Test that encrypt and then again encrypts (Super encryption) WS-Security envelope and then verifies it

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or verification

testX509EncryptionThumb

public void testX509EncryptionThumb()
                             throws java.lang.Exception
Test that encrypts and decrypts a WS-Security envelope. The test uses the ThumbprintSHA1 key identifier type.

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or decryption

testX509EncryptionSHA1

public void testX509EncryptionSHA1()
                            throws java.lang.Exception
Test that encrypts and decrypts a WS-Security envelope. The test uses the EncryptedKeySHA1 key identifier type.

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or decryption

testEncryptionSHA1Symmetric

public void testEncryptionSHA1Symmetric()
                                 throws java.lang.Exception
Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key, rather than a generated session key which is then encrypted using a public key.

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or decryption

testEncryptionSHA1SymmetricBytes

public void testEncryptionSHA1SymmetricBytes()
                                      throws java.lang.Exception
Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key (bytes), rather than a generated session key which is then encrypted using a public key.

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or decryption

testEncryptionSHA1SymmetricBytesHandler

public void testEncryptionSHA1SymmetricBytesHandler()
                                             throws java.lang.Exception
Test that encrypts using EncryptedKeySHA1, where it uses a symmetric key, rather than a generated session key which is then encrypted using a public key. The request is generated using WSHandler, instead of coding it.

Throws:
java.lang.Exception - Thrown when there is any problem in encryption or decryption

testEncryptionDecryptionRSA15STR

public void testEncryptionDecryptionRSA15STR()
                                      throws java.lang.Exception
Test that encrypt and decrypt a WS-Security envelope. This test uses the RSA_15 algorithm to transport (wrap) the symmetric key. The test case creates a ReferenceList element that references EncryptedData elements. The ReferencesList element is put into the Security header, not as child of the EncryptedKey. The EncryptedData elements contain a KeyInfo that references the EncryptedKey via a STR/Reference structure. Refer to OASIS WS Security spec 1.1, chap 7.7

Throws:
java.lang.Exception

testBadAttribute

public void testBadAttribute()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testEmbeddedEncryptedKey

public void testEmbeddedEncryptedKey()
                              throws java.lang.Exception
In this test an EncryptedKey structure is embedded in the EncryptedData structure. The EncryptedKey structure refers to a certificate via the SKI_KEY_IDENTIFIER.

Throws:
java.lang.Exception

testEncryptionDecryptionOAEPSHA256

public void testEncryptionDecryptionOAEPSHA256()
                                        throws java.lang.Exception
Test that encrypt and decrypt a WS-Security envelope. This test uses the RSA OAEP algorithm to transport (wrap) the symmetric key and SHA-256.

Throws:
java.lang.Exception - Thrown when there is any problem in signing or verification


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.