本文整理匯總了Java中javax.xml.crypto.dsig.DigestMethod.SHA512屬性的典型用法代碼示例。如果您正苦於以下問題:Java DigestMethod.SHA512屬性的具體用法?Java DigestMethod.SHA512怎麽用?Java DigestMethod.SHA512使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.xml.crypto.dsig.DigestMethod
的用法示例。
在下文中一共展示了DigestMethod.SHA512屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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.");
}
示例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);
}