当前位置: 首页>>代码示例>>Java>>正文


Java SecurityHelper.getKeyAlgorithmFromURI方法代码示例

本文整理汇总了Java中org.opensaml.xml.security.SecurityHelper.getKeyAlgorithmFromURI方法的典型用法代码示例。如果您正苦于以下问题:Java SecurityHelper.getKeyAlgorithmFromURI方法的具体用法?Java SecurityHelper.getKeyAlgorithmFromURI怎么用?Java SecurityHelper.getKeyAlgorithmFromURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensaml.xml.security.SecurityHelper的用法示例。


在下文中一共展示了SecurityHelper.getKeyAlgorithmFromURI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import org.opensaml.xml.security.SecurityHelper; //导入方法依赖的package包/类
/** {@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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:ExplicitKeySignatureTrustEngine.java

示例2: buildKeyAlgorithmCriteria

import org.opensaml.xml.security.SecurityHelper; //导入方法依赖的package包/类
/**
 * Dynamically construct key algorithm credential criteria based on the specified algorithm URI.
 * 
 * @param encAlgorithmURI the algorithm URI
 * @return a new key algorithm credential criteria instance, or null if criteria could not be determined
 */
private KeyAlgorithmCriteria buildKeyAlgorithmCriteria(String encAlgorithmURI) {
    if (DatatypeHelper.isEmpty(encAlgorithmURI)) {
        return null;
    }

    String jcaKeyAlgorithm = SecurityHelper.getKeyAlgorithmFromURI(encAlgorithmURI);
    if (!DatatypeHelper.isEmpty(jcaKeyAlgorithm)) {
        return new KeyAlgorithmCriteria(jcaKeyAlgorithm);
    }

    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Decrypter.java


注:本文中的org.opensaml.xml.security.SecurityHelper.getKeyAlgorithmFromURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。