我正在尝试与 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;
2 回答
达令说
TA贡献1821条经验 获得超6个赞
通过您的更改,我得到了 KEY LENGTH 已知错误,在点击以下链接后问题已解决
org.apache.xml.security.encryption.XMLEncryptionException:非法密钥大小原始异常是 java.security.InvalidKeyException:非法密钥大小
添加回答
举报
0/150
提交
取消