當前位置: 首頁>>代碼示例>>Java>>正文


Java DigestMethod.SHA1屬性代碼示例

本文整理匯總了Java中javax.xml.crypto.dsig.DigestMethod.SHA1屬性的典型用法代碼示例。如果您正苦於以下問題:Java DigestMethod.SHA1屬性的具體用法?Java DigestMethod.SHA1怎麽用?Java DigestMethod.SHA1使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.xml.crypto.dsig.DigestMethod的用法示例。


在下文中一共展示了DigestMethod.SHA1屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDigestAlgorithmUri

protected String getDigestAlgorithmUri() throws XmlSignatureException {

        String result = getConfiguration().getDigestAlgorithm();
        if (result == null) {
            String signatureAlgorithm = getConfiguration().getSignatureAlgorithm();
            if (signatureAlgorithm != null) {
                if (signatureAlgorithm.contains(SHA1)) {
                    result = DigestMethod.SHA1;
                } else if (signatureAlgorithm.contains(SHA224)) {
                    result = HTTP_WWW_W3_ORG_2001_04_XMLDSIG_MORE_SHA224;
                } else if (signatureAlgorithm.contains(SHA256)) {
                    result = DigestMethod.SHA256;
                } else if (signatureAlgorithm.contains(SHA384)) {
                    result = HTTP_WWW_W3_ORG_2001_04_XMLDSIG_MORE_SHA384;
                } else if (signatureAlgorithm.contains(SHA512)) {
                    result = DigestMethod.SHA512;
                } else if (signatureAlgorithm.contains(RIPEMD160)) {
                    return DigestMethod.RIPEMD160;
                }
            }
        }
        if (result != null) {
            LOG.debug("Digest algorithm: {}", result);
            return result;
        }
        throw new XmlSignatureException(
                "Digest algorithm missing for XML signature generation. Specify the digest algorithm in the configuration.");
    }
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:28,代碼來源:XmlSignerProcessor.java

示例2: getXmlDigestAlgo

private String getXmlDigestAlgo(String digestAlgo) {
	if ("SHA-1".equals(digestAlgo)) {
		return DigestMethod.SHA1;
	}
	if ("SHA-256".equals(digestAlgo)) {
		return DigestMethod.SHA256;
	}
	if ("SHA-512".equals(digestAlgo)) {
		return DigestMethod.SHA512;
	}
	throw new RuntimeException("unsupported digest algo: " + digestAlgo);
}
 
開發者ID:e-Contract,項目名稱:eid-applet,代碼行數:12,代碼來源:AbstractXmlSignatureService.java

示例3: initReference

private Reference initReference(XMLSignatureFactory fac) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
        List transformers = new ArrayList();
        transformers.add(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));

        String dm = map.getProperty(SIGNATURE_OPTION_DIGEST_METHOD);
        if (dm == null) {
                dm = DigestMethod.SHA1;
        }
        Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
        return ref;
}
 
開發者ID:apache,項目名稱:juddi,代碼行數:11,代碼來源:DigSigUtil.java

示例4: initReference

private Reference initReference(XMLSignatureFactory fac) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
    List transformers = new ArrayList();
    transformers.add(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));

    //  String dm = map.getProperty(SIGNATURE_OPTION_DIGEST_METHOD);
    //if (dm == null) {
    String dm = DigestMethod.SHA1;
    //}
    Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
    return ref;
}
 
開發者ID:apache,項目名稱:juddi,代碼行數:11,代碼來源:XmlSignatureApplet.java


注:本文中的javax.xml.crypto.dsig.DigestMethod.SHA1屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。