本文整理了Java中org.opensaml.xml.signature.Signature.getKeyInfo()
方法的一些代码示例,展示了Signature.getKeyInfo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getKeyInfo()
方法的具体详情如下:
包路径:org.opensaml.xml.signature.Signature
类名称:Signature
方法名:getKeyInfo
[英]Gets the key info added to this signature.
[中]获取添加到此签名的密钥信息。
代码示例来源:origin: org.opensaml/xmltooling
if (signature.getKeyInfo() != null) {
KeyInfoCriteria keyInfoCriteria = new KeyInfoCriteria(signature.getKeyInfo());
CriteriaSet keyInfoCriteriaSet = new CriteriaSet(keyInfoCriteria);
代码示例来源:origin: io.apigee.opensaml/xmltooling
if (signature.getKeyInfo() != null) {
KeyInfoCriteria keyInfoCriteria = new KeyInfoCriteria(signature.getKeyInfo());
CriteriaSet keyInfoCriteriaSet = new CriteriaSet(keyInfoCriteria);
代码示例来源:origin: se.skltp.adapterservices.se.apotekensservice/TicketMachine
private void validateSignature(Assertion assertion) throws ValidationException, CertificateException{
assertion.validate(true);
Signature signature = assertion.getSignature();
KeyInfo inf = signature.getKeyInfo();
List<X509Certificate> certs = KeyInfoHelper.getCertificates(inf);
if (certs == null || certs.isEmpty() ){
throw new CertificateException("KeyInfoHelper contains no certificates, unable to validate signature!");
}
X509Certificate cert = certs.get(0);
//TODO: verify certificate issuer/subject?
// Principal pr = cert.getIssuerDN();
// pr = cert.getSubjectDN();
SAMLSignatureProfileValidator pv = new SAMLSignatureProfileValidator();
pv.validate(signature);
BasicX509Credential credential = new BasicX509Credential();
credential.setEntityCertificate(cert);
SignatureValidator sigValidator = new SignatureValidator(credential);
sigValidator.validate(signature);
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.relyingparty
this.keyInfoElement = sig.getKeyInfo().getDOM();
} else {
代码示例来源:origin: org.apache.ws.security/wss4j
/**
* Verify the signature of this assertion
*
* @throws ValidationException
*/
public void verifySignature(
RequestData data, WSDocInfo docInfo
) throws WSSecurityException {
Signature sig = getSignature();
if (sig != null) {
KeyInfo keyInfo = sig.getKeyInfo();
if (keyInfo == null) {
throw new WSSecurityException(
WSSecurityException.FAILURE, "invalidSAMLsecurity",
new Object[]{"cannot get certificate or key"}
);
}
SAMLKeyInfo samlKeyInfo =
SAMLUtil.getCredentialFromKeyInfo(keyInfo.getDOM(), data, docInfo, data.getWssConfig().isWsiBSPCompliant());
verifySignature(samlKeyInfo);
} else {
LOG.debug("AssertionWrapper: no signature to validate");
}
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.relyingparty
KeyInfo kinfo = signature.getKeyInfo();
List<X509Data> dataList = null;
List<KeyValue> keyValueList = null;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
/**
* Verify the signature of this assertion
*
* @throws ValidationException
*/
public void verifySignature(
RequestData data, WSDocInfo docInfo
) throws WSSecurityException {
Signature sig = getSignature();
if (sig != null) {
KeyInfo keyInfo = sig.getKeyInfo();
if (keyInfo == null) {
throw new WSSecurityException(
WSSecurityException.FAILURE, "invalidSAMLsecurity",
new Object[]{"cannot get certificate or key"}
);
}
SAMLKeyInfo samlKeyInfo =
SAMLUtil.getCredentialFromKeyInfo(keyInfo.getDOM(), data, docInfo, data.getWssConfig().isWsiBSPCompliant());
verifySignature(samlKeyInfo);
} else {
LOG.debug("AssertionWrapper: no signature to validate");
}
}
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
/**
* Validate the specified opensaml XML Signature
*
* @param signature
* the XML signature
* @return list of {@link X509Certificate}'s in the XML signature
* @throws CertificateException
* something went wrong extracting the certificates from the XML
* Signature.
* @throws ValidationException
* validation failed
*/
public static List<X509Certificate> validateSignature(Signature signature)
throws CertificateException, ValidationException {
List<X509Certificate> certChain = KeyInfoHelper
.getCertificates(signature.getKeyInfo());
SAMLSignatureProfileValidator pv = new SAMLSignatureProfileValidator();
pv.validate(signature);
BasicX509Credential credential = new BasicX509Credential();
credential.setPublicKey(getEndCertificate(certChain).getPublicKey());
SignatureValidator sigValidator = new SignatureValidator(credential);
sigValidator.validate(signature);
return certChain;
}
代码示例来源:origin: org.opensaml/xmltooling
Element signatureElement = dsig.getElement();
if (signature.getKeyInfo() != null) {
Marshaller keyInfoMarshaller = Configuration.getMarshallerFactory().getMarshaller(
KeyInfo.DEFAULT_ELEMENT_NAME);
keyInfoMarshaller.marshall(signature.getKeyInfo(), signatureElement);
代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-saml2
List<X509Certificate> certChain = KeyInfoHelper
.getCertificates(samlResponse.getSignature()
.getKeyInfo());
代码示例来源:origin: io.apigee.opensaml/xmltooling
Element signatureElement = dsig.getElement();
if (signature.getKeyInfo() != null) {
Marshaller keyInfoMarshaller = Configuration.getMarshallerFactory().getMarshaller(
KeyInfo.DEFAULT_ELEMENT_NAME);
keyInfoMarshaller.marshall(signature.getKeyInfo(), signatureElement);
代码示例来源:origin: io.apigee.opensaml/xmltooling
if (signature.getKeyInfo() == null) {
KeyInfoGenerator kiGenerator = getKeyInfoGenerator(signingCredential, secConfig, keyInfoGenName);
if (kiGenerator != null) {
代码示例来源:origin: org.opensaml/xmltooling
if (signature.getKeyInfo() == null) {
KeyInfoGenerator kiGenerator = getKeyInfoGenerator(signingCredential, secConfig, keyInfoGenName);
if (kiGenerator != null) {
代码示例来源:origin: org.apache.ws.security/wss4j
if (samlAssertion.isSigned()) {
Signature sig = samlAssertion.getSignature();
KeyInfo keyInfo = sig.getKeyInfo();
if (keyInfo == null) {
throw new WSSecurityException(
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
if (samlAssertion.isSigned()) {
Signature sig = samlAssertion.getSignature();
KeyInfo keyInfo = sig.getKeyInfo();
if (keyInfo == null) {
throw new WSSecurityException(
内容来源于网络,如有侵权,请联系作者删除!