本文整理了Java中org.opensaml.xml.signature.Signature.getSignatureAlgorithm()
方法的一些代码示例,展示了Signature.getSignatureAlgorithm()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getSignatureAlgorithm()
方法的具体详情如下:
包路径:org.opensaml.xml.signature.Signature
类名称:Signature
方法名:getSignatureAlgorithm
[英]Gets the algorithm used to compute the signature.
[中]获取用于计算签名的算法。
代码示例来源:origin: org.opensaml/xmltooling
/**
* Check the signature method.
*
* @param xmlObject the object to be validated
* @throws ValidationException thrown if object is invalid
*/
protected void validateSignatureMethod(Signature xmlObject) throws ValidationException {
if (DatatypeHelper.isEmpty(xmlObject.getSignatureAlgorithm())) {
throw new ValidationException("The SignatureMethod value was empty");
}
}
代码示例来源:origin: io.apigee.opensaml/xmltooling
/**
* Check the signature method.
*
* @param xmlObject the object to be validated
* @throws ValidationException thrown if object is invalid
*/
protected void validateSignatureMethod(Signature xmlObject) throws ValidationException {
if (DatatypeHelper.isEmpty(xmlObject.getSignatureAlgorithm())) {
throw new ValidationException("The SignatureMethod value was empty");
}
}
代码示例来源:origin: org.opensaml/xmltooling
/** {@inheritDoc} */
public void validate(Signature signature) throws ValidationException {
log.debug("Attempting to validate signature using key from supplied credential");
XMLSignature xmlSig = buildSignature(signature);
Key validationKey = SecurityHelper.extractVerificationKey(validationCredential);
if (validationKey == null) {
log.debug("Supplied credential contained no key suitable for signature validation");
throw new ValidationException("No key available to validate signature");
}
log.debug("Validating signature with signature algorithm URI: {}", signature.getSignatureAlgorithm());
log.debug("Validation credential key algorithm '{}', key instance class '{}'",
validationKey.getAlgorithm(), validationKey.getClass().getName());
try {
if (xmlSig.checkSignatureValue(validationKey)) {
log.debug("Signature validated with key from supplied credential");
return;
}
} catch (XMLSignatureException e) {
throw new ValidationException("Unable to evaluate key against signature", e);
}
log.debug("Signature did not validate against the credential's key");
throw new ValidationException("Signature did not validate against the credential's key");
}
代码示例来源:origin: io.apigee.opensaml/xmltooling
/** {@inheritDoc} */
public void validate(Signature signature) throws ValidationException {
log.debug("Attempting to validate signature using key from supplied credential");
XMLSignature xmlSig = buildSignature(signature);
Key validationKey = SecurityHelper.extractVerificationKey(validationCredential);
if (validationKey == null) {
log.debug("Supplied credential contained no key suitable for signature validation");
throw new ValidationException("No key available to validate signature");
}
log.debug("Validating signature with signature algorithm URI: {}", signature.getSignatureAlgorithm());
log.debug("Validation credential key algorithm '{}', key instance class '{}'",
validationKey.getAlgorithm(), validationKey.getClass().getName());
try {
if (xmlSig.checkSignatureValue(validationKey)) {
log.debug("Signature validated with key from supplied credential");
return;
}
} catch (XMLSignatureException e) {
throw new ValidationException("Unable to evaluate key against signature", e);
}
log.debug("Signature did not validate against the credential's key");
throw new ValidationException("Signature did not validate against the credential's key");
}
代码示例来源:origin: org.opensaml/xmltooling
log.debug("Creating XMLSignature object");
XMLSignature dsig = null;
if (signature.getHMACOutputLength() != null && SecurityHelper.isHMAC(signature.getSignatureAlgorithm())) {
dsig = new XMLSignature(document, "", signature.getSignatureAlgorithm(), signature
.getHMACOutputLength(), signature.getCanonicalizationAlgorithm());
} else {
dsig = new XMLSignature(document, "", signature.getSignatureAlgorithm(), signature
.getCanonicalizationAlgorithm());
代码示例来源:origin: io.apigee.opensaml/xmltooling
log.debug("Creating XMLSignature object");
XMLSignature dsig = null;
if (signature.getHMACOutputLength() != null && SecurityHelper.isHMAC(signature.getSignatureAlgorithm())) {
dsig = new XMLSignature(document, "", signature.getSignatureAlgorithm(), signature
.getHMACOutputLength(), signature.getCanonicalizationAlgorithm());
} else {
dsig = new XMLSignature(document, "", signature.getSignatureAlgorithm(), signature
.getCanonicalizationAlgorithm());
代码示例来源:origin: usnistgov/iheos-toolkit2
private static void extractSignatureInfo(Assertion assertion, AssertionType assertOut) {
SamlSignatureType samlSignature = assertOut.getSamlSignature() ;
SamlSignatureKeyInfoType samlSignatureKeyInfoType = samlSignature.getKeyInfo() ;
byte []signatureValue = samlSignature.getSignatureValue();
samlSignature.getKeyInfo().getRsaKeyValueExponent();
samlSignature.getKeyInfo().getRsaKeyValueModulus() ;
Signature signature = assertion.getSignature() ;
assertion.getSignature().getCanonicalizationAlgorithm();
signature.getSignatureAlgorithm();
List<ContentReference> contentReference1 = signature.getContentReferences();
ContentReference contentReference = (ContentReference)contentReference1.get(0);
signature.getSigningCredential().getPublicKey().getAlgorithm();
//signature.getSigningCredential().
}
private static String getSubjectNameIDValue(Assertion assertion) {
代码示例来源:origin: org.opensaml/xmltooling
/** {@inheritDoc} */
public boolean validate(Signature signature, CriteriaSet trustBasisCriteria) throws SecurityException {
checkParams(signature, trustBasisCriteria);
CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.addAll(trustBasisCriteria);
if (!criteriaSet.contains(UsageCriteria.class)) {
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
}
String jcaAlgorithm = SecurityHelper.getKeyAlgorithmFromURI(signature.getSignatureAlgorithm());
if (!DatatypeHelper.isEmpty(jcaAlgorithm)) {
criteriaSet.add(new KeyAlgorithmCriteria(jcaAlgorithm), true);
}
Iterable<Credential> trustedCredentials = getCredentialResolver().resolve(criteriaSet);
if (validate(signature, trustedCredentials)) {
return true;
}
// If the credentials extracted from Signature's KeyInfo (if any) did not verify the
// signature and/or establish trust, as a fall back attempt to verify the signature with
// the trusted credentials directly.
log.debug("Attempting to verify signature using trusted credentials");
for (Credential trustedCredential : trustedCredentials) {
if (verifySignature(signature, trustedCredential)) {
log.debug("Successfully verified signature using resolved trusted credential");
return true;
}
}
log.debug("Failed to verify signature using either KeyInfo-derived or directly trusted credentials");
return false;
}
代码示例来源:origin: io.apigee.opensaml/xmltooling
/** {@inheritDoc} */
public boolean validate(Signature signature, CriteriaSet trustBasisCriteria) throws SecurityException {
checkParams(signature, trustBasisCriteria);
CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.addAll(trustBasisCriteria);
if (!criteriaSet.contains(UsageCriteria.class)) {
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
}
String jcaAlgorithm = SecurityHelper.getKeyAlgorithmFromURI(signature.getSignatureAlgorithm());
if (!DatatypeHelper.isEmpty(jcaAlgorithm)) {
criteriaSet.add(new KeyAlgorithmCriteria(jcaAlgorithm), true);
}
Iterable<Credential> trustedCredentials = getCredentialResolver().resolve(criteriaSet);
if (validate(signature, trustedCredentials)) {
return true;
}
// If the credentials extracted from Signature's KeyInfo (if any) did not verify the
// signature and/or establish trust, as a fall back attempt to verify the signature with
// the trusted credentials directly.
log.debug("Attempting to verify signature using trusted credentials");
for (Credential trustedCredential : trustedCredentials) {
if (verifySignature(signature, trustedCredential)) {
log.debug("Successfully verified signature using resolved trusted credential");
return true;
}
}
log.debug("Failed to verify signature using either KeyInfo-derived or directly trusted credentials");
return false;
}
代码示例来源:origin: io.apigee.opensaml/xmltooling
String signAlgo = signature.getSignatureAlgorithm();
if (signAlgo == null) {
signAlgo = secConfig.getSignatureAlgorithmURI(signingCredential);
代码示例来源:origin: org.opensaml/xmltooling
String signAlgo = signature.getSignatureAlgorithm();
if (signAlgo == null) {
signAlgo = secConfig.getSignatureAlgorithmURI(signingCredential);
内容来源于网络,如有侵权,请联系作者删除!