You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Siva Kumar <Si...@kilnplc.com> on 2006/05/17 13:58:06 UTC
FW: WS-S Signature & namespaces
Hello,
When we sign a SOAP message (see the code below), the output contains
lots of namespaces all over the place both on the SOAP header and on the
Body . See attachment for a sample signed messages.
Are all of these namespaces mandatory? If these namespaces are not
mandatory, Is there any way to minimize the namespaces?
Thanks & Best Regards,
Siva.
------------------
Code extract:
public static Document generateSignature( Document document, String
keyAlias, String password, KeyStore keyStore, String keyIdentifierOption
)
throws CredentialException, IOException, Exception
{
String soapNamespace =
document.getDocumentElement().getNamespaceURI();
WSSignEnvelope signature = new WSSignEnvelope();
signature.setSignatureAlgorithm( WSConstants.RSA
);
signature.setSigCanonicalization(
WSConstants.C14N_EXCL_OMIT_COMMENTS );
if
(keyIdentifierOption.equals("BST_DIRECT_REFERENCE"))
{
signature.setKeyIdentifierType(
WSConstants.BST_DIRECT_REFERENCE);
}
else
if(keyIdentifierOption.equals("ISSUER_SERIAL"))
{
signature.setKeyIdentifierType( WSConstants.ISSUER_SERIAL);
}
else
if(keyIdentifierOption.equals("X509_KEY_IDENTIFIER"))
{
signature.setKeyIdentifierType(
WSConstants.X509_KEY_IDENTIFIER);
}
else if(keyIdentifierOption.equals("SKI_KEY_IDENTIFIER"))
{
signature.setKeyIdentifierType( WSConstants.SKI_KEY_IDENTIFIER);
}
signature.setUserInfo( keyAlias, password );
Vector signedParts = new Vector();
WSEncryptionPart bodyPart = new WSEncryptionPart( "Body",
soapNamespace, "" );
signedParts.add( bodyPart );
signature.setParts( signedParts );
Merlin merlin = new Merlin( null );
merlin.setKeyStore( keyStore );
Document out = signature.build( document, merlin );
************************************************************************
The information in this email, together with any attachments, is confidential and intended for the sole use of the addressee; the information may be legally privileged. Access, copying, disclosure or re-use, in any way, of the information contained in this email by anyone other than the addressee/addressees is not permitted. Kiln plc, its subsidiaries or affiliates (the Kiln Group) accept no legal responsibility for the content of the message. Any opinions or views presented are solely the responsibility of the author and do not necessarily represent those of the Kiln Group. If you have read this email in error, please return it to the sender.
The Kiln Group monitors the content of emails sent and received via its network for the purposes of ensuring compliance with its policies and procedures. Although the Kiln Group attempts to filter emails and attachments for viruses, it does not guarantee that either is virus free and accepts no liability for any damage sustained as a result of viruses.
The registered office of Kiln plc is 106 Fenchurch Street, London, UK EC3M 5NR
~~~~~~~~~~~~~
This e-mail has been scanned for all viruses by Star Internet, visit:
http://www.star.net.uk
*********************************************************************