本文整理匯總了Java中javax.xml.crypto.dsig.SignatureMethod.RSA_SHA1屬性的典型用法代碼示例。如果您正苦於以下問題:Java SignatureMethod.RSA_SHA1屬性的具體用法?Java SignatureMethod.RSA_SHA1怎麽用?Java SignatureMethod.RSA_SHA1使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.xml.crypto.dsig.SignatureMethod
的用法示例。
在下文中一共展示了SignatureMethod.RSA_SHA1屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromAlg
private String fromAlg ( final String alg )
{
if ( "DSA".equals ( alg ) )
{
return SignatureMethod.DSA_SHA1;
}
else if ( "RSA".equals ( alg ) )
{
return SignatureMethod.RSA_SHA1;
}
else if ( "HMAC".equals ( alg ) )
{
return SignatureMethod.HMAC_SHA1;
}
else
{
throw new IllegalArgumentException ( String.format ( "Key algorithm '%s' is not supported", alg ) );
}
}
示例2: getSignatureMethod
private String getSignatureMethod(DigestAlgo digestAlgo) {
if (null == digestAlgo) {
throw new RuntimeException("digest algo is null");
}
switch (digestAlgo) {
case SHA1:
return SignatureMethod.RSA_SHA1;
case SHA256:
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256;
case SHA512:
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512;
}
// TODO: complete me
// if ("SHA-384".equals(digestAlgo)) {
// return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384;
// }
// if ("RIPEMD160".equals(digestAlgo)) {
// return XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160;
// }
throw new RuntimeException("unsupported sign algo: " + digestAlgo);
}
示例3: getSignatureMethod
private String getSignatureMethod(String digestAlgo) {
if (null == digestAlgo) {
throw new RuntimeException("digest algo is null");
}
if ("SHA-1".equals(digestAlgo)) {
return SignatureMethod.RSA_SHA1;
}
if ("SHA-256".equals(digestAlgo)) {
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256;
}
if ("SHA-512".equals(digestAlgo)) {
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512;
}
if ("SHA-384".equals(digestAlgo)) {
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384;
}
if ("RIPEMD160".equals(digestAlgo)) {
return XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160;
}
throw new RuntimeException("unsupported sign algo: " + digestAlgo);
}
示例4: initSignedInfo
private SignedInfo initSignedInfo(XMLSignatureFactory fac) throws Exception {
Reference ref = initReference(fac);
String cm = null;
cm = map.getProperty(CANONICALIZATIONMETHOD);
String sigmethod = null;
sigmethod = map.getProperty(SIGNATURE_METHOD);
if (sigmethod == null) {
sigmethod = SignatureMethod.RSA_SHA1;
}
if (cm == null) {
cm = CanonicalizationMethod.EXCLUSIVE;
}
SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(
cm,
(C14NMethodParameterSpec) null),
fac.newSignatureMethod(sigmethod,
null), Collections.singletonList(ref));
return si;
}