我正在嘗試與 OpenSAML2 (2.6.6) 一起編寫 Java 應用程序來解密加密的斷言,但我得到:[main] ERROR org.opensaml.xml.encryption.Decrypter - Failed to decrypt EncryptedKey, valid decryption key could not be resolved[main] ERROR org.opensaml.xml.encryption.Decrypter - Failed to decrypt EncryptedData using either EncryptedData KeyInfoCredentialResolver or EncryptedKeyResolver + EncryptedKey KeyInfoCredentialResolver[main] ERROR org.opensaml.saml2.encryption.Decrypter - SAML Decrypter encountered an error decrypting element content這是我的 Java 代碼(抱歉,它仍然有很多調試輸出):/* * **************************************************************************************************** * Original source from: https://stackoverflow.com/questions/9422545/decrypting-encrypted-assertion-using-saml-2-0-in-java-using-opensaml * And hint about needed to add DefaultBootstrap.bootstrap() for OpenSAML 2.x: https://stackoverflow.com/questions/25066183/opensaml-error-receiving-correct-unmarshaller * And hing about chain resolvers: https://www.programcreek.com/java-api-examples/index.php?api=org.opensaml.saml2.encryption.Decrypter * **************************************************************************************************** * **************************************************************************************************** * **************************************************************************************************** * **************************************************************************************************** */import java.io.File;import java.io.FileInputStream;import java.io.InputStream;import java.security.KeyFactory;import java.security.interfaces.RSAPrivateKey;import java.security.spec.PKCS8EncodedKeySpec;import java.util.ArrayList;import java.util.List;
如何使用 OpenSAML 2 和 Java 測試/調試解密加密斷言?
慕田峪9158850
2022-06-15 14:39:41