本文整理汇总了Java中org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha384方法的典型用法代码示例。如果您正苦于以下问题:Java NISTObjectIdentifiers.id_sha384方法的具体用法?Java NISTObjectIdentifiers.id_sha384怎么用?Java NISTObjectIdentifiers.id_sha384使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.nist.NISTObjectIdentifiers
的用法示例。
在下文中一共展示了NISTObjectIdentifiers.id_sha384方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOIDForHashAlgorithm
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public static ASN1ObjectIdentifier getOIDForHashAlgorithm(int hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return PKCSObjectIdentifiers.md5;
case HashAlgorithm.sha1:
return X509ObjectIdentifiers.id_SHA1;
case HashAlgorithm.sha224:
return NISTObjectIdentifiers.id_sha224;
case HashAlgorithm.sha256:
return NISTObjectIdentifiers.id_sha256;
case HashAlgorithm.sha384:
return NISTObjectIdentifiers.id_sha384;
case HashAlgorithm.sha512:
return NISTObjectIdentifiers.id_sha512;
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例2: getOIDForHashAlgorithm
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public static ASN1ObjectIdentifier getOIDForHashAlgorithm(short hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return PKCSObjectIdentifiers.md5;
case HashAlgorithm.sha1:
return X509ObjectIdentifiers.id_SHA1;
case HashAlgorithm.sha224:
return NISTObjectIdentifiers.id_sha224;
case HashAlgorithm.sha256:
return NISTObjectIdentifiers.id_sha256;
case HashAlgorithm.sha384:
return NISTObjectIdentifiers.id_sha384;
case HashAlgorithm.sha512:
return NISTObjectIdentifiers.id_sha512;
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例3: digestInfoSha384
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
@Test
public void digestInfoSha384() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("SHA-384");
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = NISTObjectIdentifiers.id_sha384;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例4: SHA384
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public SHA384()
{
super(NISTObjectIdentifiers.id_sha384, new SHA384Digest(), new PKCS1Encoding(new RSABlindedEngine()));
}
示例5: SHA384
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public SHA384()
{
super(NISTObjectIdentifiers.id_sha384, new SHA384Digest(), new PKCS1Encoding(new NativeRSAEngine()));
}
示例6: SHA384WithRSAEncryption
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public SHA384WithRSAEncryption()
{
super(NISTObjectIdentifiers.id_sha384, new SHA384Digest(), new PKCS1Encoding(new RSABlindedEngine()));
}
示例7: testGenerateWithMetadataAndDifferentAlgorithmIdentifier
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入方法依赖的package包/类
public void testGenerateWithMetadataAndDifferentAlgorithmIdentifier()
throws Exception
{
cmsTimeStampedDataGenerator.setMetaData(true, fileInput, "TXT");
BcDigestCalculatorProvider calculatorProvider = new BcDigestCalculatorProvider();
ASN1ObjectIdentifier algIdentifier = NISTObjectIdentifiers.id_sha224;
DigestCalculator hashCalculator = calculatorProvider.get(new AlgorithmIdentifier(algIdentifier));
cmsTimeStampedDataGenerator.initialiseMessageImprintDigestCalculator(hashCalculator);
hashCalculator.getOutputStream().write(baseData);
hashCalculator.getOutputStream().close();
byte[] requestData = hashCalculator.getDigest();
TimeStampToken timeStampToken = createTimeStampToken(requestData, algIdentifier);
CMSTimeStampedData cmsTimeStampedData = cmsTimeStampedDataGenerator.generate(timeStampToken, baseData);
for (int i = 0; i < 3; i++) {
switch (i) {
case 0:
algIdentifier = NISTObjectIdentifiers.id_sha224;
break;
case 1:
algIdentifier = NISTObjectIdentifiers.id_sha256;
break;
case 2:
algIdentifier = NISTObjectIdentifiers.id_sha384;
break;
case 3:
algIdentifier = NISTObjectIdentifiers.id_sha512;
break;
}
hashCalculator = calculatorProvider.get(new AlgorithmIdentifier(algIdentifier));
byte[] newRequestData = cmsTimeStampedData.calculateNextHash(hashCalculator);
TimeStampToken newTimeStampToken = createTimeStampToken(newRequestData, algIdentifier);
cmsTimeStampedData = cmsTimeStampedData.addTimeStamp(newTimeStampToken);
}
byte[] timeStampedData = cmsTimeStampedData.getEncoded();
metadataCheck(timeStampedData);
metadataParserCheck(timeStampedData);
}