WSS4J セキュア Web サービスであるコードをいくつか継承しました。これは、この人気のあるチュートリアルに基づいています: http://distributedsenses.blogspot.com/2008/09/configuring-cxf-for-web-service.html
現在、サーバー側は他のクライアントと連携していますが、私のものはそうではありません。:(
Tomcat のキーストアを生成し、公開キーをエクスポートして、サーバーにインストールしました。しかし、私が呼び出しを試みたとき、サーバーはエラーで応答します 復号化のための証明書が見つかりませんでした (KeyId)
今、私はコードに変更を加えていませんが、パッケージ名を変更しました (SOAP 呼び出しには関係ないと思います)。名前空間は変更しませんでした。
サーバーに証明書をエクスポートして、証明書が正しくインポートされたことを確認し、クライアントの公開鍵と正確に一致するようにしました。したがって、サーバーに証明書があることはわかっています。
これが私のOutInterceptorです
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor" id="TimestampSignEncrypt_Request"> <constructor-arg> <map> <entry key="action" value="Timestamp Signature Encrypt"/> <entry key="user" value="clientwin"/> <entry key="encryptionUser" value="tomcat2"/> <entry key="signatureKeyIdentifier" value="DirectReference"/> <entry key="signaturePropFile" value="clientSign.properties"/> <entry key="encryptionPropFile" value="clientEncrypt.properties"/> <entry key="passwordCallbackClass" value="ClientKeystorePasswordCallback"/> <entry key="signatureParts" value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/> <entry key="encryptionParts" value="{Element}{http://www.w3.org/2000/09/xmldsig#}Signature;{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body"/> <entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <entry key="encryptionKeyTransportAlgorithm" value="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/> <entry key="signatureAlgorithm" value="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> </map> </constructor-arg> </bean>
そして私のclientSign.properties
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=changeit
org.apache.ws.security.crypto.merlin.keystore.alias=clientwin
org.apache.ws.security.crypto.merlin.file=C:\\apache-tomcat-7.0.55\\ssl\\.keystore
このエラーが発生する理由。公開鍵がサーバーのトラストストアにあることを知っています。そして、これは他のクライアントでも機能します。私が間違っていることは何ですか?