org.apache.ws.security.message
Class SignatureCertTest

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

public class SignatureCertTest
extends org.junit.Assert

This is a test for WSS-40. Essentially it just tests that a message is signed using a keyEntry from one keystore, and verified at the other end with a keystore with just the CA cert in it. http://issues.apache.org/jira/browse/WSS-40 Generate the CA keys/certs + export the CA cert to a keystore openssl req -x509 -newkey rsa:1024 -keyout wss40CAKey.pem -out wss40CA.pem -config ca.config -days 3650 openssl x509 -outform DER -in wss40CA.pem -out wss40CA.crt keytool -import -file wss40CA.crt -alias wss40CA -keystore wss40CA.jks Generate the client keypair, make a csr, sign it with the CA key keytool -genkey -validity 3650 -alias wss40 -keyalg RSA -keystore wss40.jks -dname "CN=Colm,OU=WSS4J,O=Apache,L=Dublin,ST=Leinster,C=IE" keytool -certreq -alias wss40 -keystore wss40.jks -file wss40.cer openssl ca -config ca.config -policy policy_anything -days 3650 -out wss40.pem -infiles wss40.cer openssl x509 -outform DER -in wss40.pem -out wss40.crt Import the CA cert into wss40.jks and import the new signed certificate keytool -import -file wss40CA.crt -alias wss40CA -keystore wss40.jks keytool -import -file wss40.crt -alias wss40 -keystore wss40.jks


Constructor Summary
SignatureCertTest()
           
 
Method Summary
 void testBSTCertChain()
           
 void testMultipleCertsWSHandler()
          A test for "SignatureAction does not set DigestAlgorithm on WSSecSignature instance"
 void testSignatureBadCACert()
          Test signing a SOAP message using a BST.
 void testSignatureDirectReference()
          Test signing a SOAP message using a BST.
 void testSignatureDirectReferenceCACert()
          Test signing a SOAP message using a BST, sending the CA cert as well in the message.
 void testSignatureIssuerSerial()
          Test signing a SOAP message using Issuer Serial.
 
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

SignatureCertTest

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

testSignatureDirectReference

public void testSignatureDirectReference()
                                  throws java.lang.Exception
Test signing a SOAP message using a BST.

Throws:
java.lang.Exception

testBSTCertChain

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

testSignatureDirectReferenceCACert

public void testSignatureDirectReferenceCACert()
                                        throws java.lang.Exception
Test signing a SOAP message using a BST, sending the CA cert as well in the message.

Throws:
java.lang.Exception

testSignatureIssuerSerial

public void testSignatureIssuerSerial()
                               throws java.lang.Exception
Test signing a SOAP message using Issuer Serial. Note that this should fail, as the trust-store does not contain the cert corresponding to wss40, only the CA cert wss40CA.

Throws:
java.lang.Exception

testSignatureBadCACert

public void testSignatureBadCACert()
                            throws java.lang.Exception
Test signing a SOAP message using a BST. The signature verification passes, but the trust verification will fail as the CA cert is out of date.

Throws:
java.lang.Exception

testMultipleCertsWSHandler

public void testMultipleCertsWSHandler()
                                throws java.lang.Exception
A test for "SignatureAction does not set DigestAlgorithm on WSSecSignature instance"

Throws:
java.lang.Exception


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