gpt4 book ai didi

java - 使用java代码进行Saml断言解密

转载 作者:太空宇宙 更新时间:2023-11-04 11:11:08 25 4
gpt4 key购买 nike

错误:

Exception in thread "main" org.opensaml.xml.io.UnmarshallingException: the assertion does not appear to be encrypted
at AssertionDecrypter.unmarshallEncryptedAssertion(AssertionDecrypter.java:162)
at AssertionDecrypter.decryptAssertion(AssertionDecrypter.java:119)
at AssertionDecrypter.<init>(AssertionDecrypter.java:67)
at Saml2AssertionEncoding.main(Saml2AssertionEncoding.java:112)
Caused by: java.lang.ClassCastException: org.opensaml.saml1.core.impl.ResponseImpl cannot be cast to org.opensaml.saml2.core.EncryptedAssertion
at AssertionDecrypter.unmarshallEncryptedAssertion(AssertionDecrypter.java:157)
... 3 more

我的Java代码

enter image description here

我的Pom

    <dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-core</artifactId>
<version>3.1.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>2.0.8</version>
</dependency>

<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-saml-impl</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>

<dependency>
<!-- <groupId>org.opensaml</groupId> <artifactId>xmltooling</artifactId>
<version>1.3.1</version>
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
<version>1.4.4</version> -->
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.22</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-xml</artifactId>
<version>0.16.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>openws</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
</dependencies>

最佳答案

您似乎需要调试加密的 XML 元素。您能检查 document.getDocumentElements() 的内容是否正确 XML 吗?

我猜它是空的。从上述函数成功获取原始 XML 元素后,您可以将 XML 解密为纯文本。例如,这个网站SAML Assertion Decryption - SAML Decrypt XML Tool - Decrypt SAML Response

关于java - 使用java代码进行Saml断言解密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45993491/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com