Hi there

I use WSS4J 1.5.1.

I've created the following merlin properties file:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=pkcs12
org.apache.ws.security.crypto.merlin.keystore.password=changeit
org.apache.ws.security.crypto.merlin.keystore.alias=1
org.apache.ws.security.crypto.merlin.alias.password=changeit
org.apache.ws.security.crypto.merlin.file=TestService.p12

I can list the content of the p12 file with keytool like this:
keytool -list -alias 1 -keystore TestService.p12 -storetype pkcs12 -v

The alias "1" seems to exist:
Aliasname: 1
Erstellungsdatum: 30.06.2008:
Eintragstyp: keyEntry
Zertifikatskettenlõnge: 2
Zertifikat[1]:
......

In the code I do the following:
WSSecEncrypt encryptor = new WSSecEncrypt();.
Crypto crypto = CryptoFactory.getInstance("server.properties");
java.security.cert.X509Certificate[] certs = crypto.getCertificates("1");
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>();
WSEncryptionPart part = new WSEncryptionPart(soapconstants
            .getBodyQName().getLocalPart(), soapconstants
            .getEnvelopeURI(), "Content");,
parts.add(part);
encryptor.setParts(parts);
encryptor.setUserInfo("1");
doc = encryptor.build(doc, crypto, secHeader);

but I get the following exception:

org.apache.ws.security.WSSecurityException: General security error
(Unexpected number of X509Data: for Encryption)
      at org.apache.ws.security.message.WSSecEncrypt.prepare
(WSSecEncrypt.java:211)
      at org.apache.ws.security.message.WSSecEncrypt.build
(WSSecEncrypt.java:253)


If I use a java keystore, it works.

Thanks for your help
Oliver







******************* BITTE BEACHTEN *******************
Diese Nachricht (wie auch allfällige Anhänge dazu) beinhaltet
möglicherweise vertrauliche oder gesetzlich geschützte Daten oder
Informationen. Zum Empfang derselben ist (sind) ausschliesslich die
genannte(n) Person(en) bestimmt. Falls Sie diese Nachricht
irrtümlicherweise erreicht hat, sind Sie höflich gebeten, diese unter
Ausschluss jeder Reproduktion zu zerstören und die absendende Person
umgehend zu benachrichtigen. Vielen Dank für Ihre Hilfe.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to