本文整理汇总了Java中org.bouncycastle.crypto.digests.SHA384Digest类的典型用法代码示例。如果您正苦于以下问题:Java SHA384Digest类的具体用法?Java SHA384Digest怎么用?Java SHA384Digest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SHA384Digest类属于org.bouncycastle.crypto.digests包,在下文中一共展示了SHA384Digest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static final Digest createHash(int hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例2: cloneHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static final Digest cloneHash(int hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例3: createHMACDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
protected Digest createHMACDigest(int macAlgorithm)
throws IOException
{
switch (macAlgorithm)
{
case MACAlgorithm._null:
return null;
case MACAlgorithm.hmac_md5:
return new MD5Digest();
case MACAlgorithm.hmac_sha1:
return new SHA1Digest();
case MACAlgorithm.hmac_sha256:
return new SHA256Digest();
case MACAlgorithm.hmac_sha384:
return new SHA384Digest();
case MACAlgorithm.hmac_sha512:
return new SHA512Digest();
default:
throw new TlsFatalAlert(AlertDescription.internal_error);
}
}
示例4: createHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static Digest createHash(short hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例5: cloneHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static Digest cloneHash(short hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例6: curveTest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
@Test
public void curveTest() {
final X9ECParameters curve = NISTNamedCurves.getByName("P-384");
final ECDomainParameters domainParameters = new ECDomainParameters(
curve.getCurve(), curve.getG(), curve.getN());
final SecureRandom random = new SecureRandom();
final ECKeyPairGenerator gen = new ECKeyPairGenerator();
gen.init(new ECKeyGenerationParameters(domainParameters, random));
final AsymmetricCipherKeyPair senderPair = gen.generateKeyPair();
final ECDSASigner signer = new ECDSASigner();
signer.init(true, senderPair.getPrivate());
final byte[] message = "The magic words are squeamish ossifrage".getBytes(
Constants.ASCII);
final SHA384Digest digester = new SHA384Digest();
digester.update(message, 0, message.length);
final byte[] digest = new byte[digester.getDigestSize()];
digester.doFinal(digest, 0);
final BigInteger[] signature = signer.generateSignature(digest);
final ECDSASigner verifier = new ECDSASigner();
verifier.init(false, senderPair.getPublic());
assertTrue(verifier.verifySignature(digest, signature[0], signature[1]));
}
示例7: createHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static final Digest createHash(short hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例8: cloneHash
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static final Digest cloneHash(short hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例9: createHMACDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
protected Digest createHMACDigest(int macAlgorithm) throws IOException
{
switch (macAlgorithm)
{
case MACAlgorithm._null:
return null;
case MACAlgorithm.hmac_md5:
return new MD5Digest();
case MACAlgorithm.hmac_sha1:
return new SHA1Digest();
case MACAlgorithm.hmac_sha256:
return new SHA256Digest();
case MACAlgorithm.hmac_sha384:
return new SHA384Digest();
case MACAlgorithm.hmac_sha512:
return new SHA512Digest();
default:
throw new TlsFatalAlert(AlertDescription.internal_error);
}
}
示例10: guessDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
private Digest guessDigest(int size)
{
switch (size)
{
case 20:
return new SHA1Digest();
case 28:
return new SHA224Digest();
case 32:
return new SHA256Digest();
case 48:
return new SHA384Digest();
case 64:
return new SHA512Digest();
}
return null;
}
示例11: getDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static Digest getDigest(
String digestName)
{
digestName = Strings.toUpperCase(digestName);
if (sha1.contains(digestName))
{
return new SHA1Digest();
}
if (md5.contains(digestName))
{
return new MD5Digest();
}
if (sha224.contains(digestName))
{
return new SHA224Digest();
}
if (sha256.contains(digestName))
{
return new SHA256Digest();
}
if (sha384.contains(digestName))
{
return new SHA384Digest();
}
if (sha512.contains(digestName))
{
return new SHA512Digest();
}
return null;
}
示例12: clone
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public Object clone()
throws CloneNotSupportedException
{
Digest d = (Digest)super.clone();
d.digest = new SHA384Digest((SHA384Digest)digest);
return d;
}
示例13: createDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
static Digest createDigest(int algorithm)
throws PGPException
{
switch (algorithm)
{
case HashAlgorithmTags.SHA1:
return new SHA1Digest();
case HashAlgorithmTags.SHA224:
return new SHA224Digest();
case HashAlgorithmTags.SHA256:
return new SHA256Digest();
case HashAlgorithmTags.SHA384:
return new SHA384Digest();
case HashAlgorithmTags.SHA512:
return new SHA512Digest();
case HashAlgorithmTags.MD2:
return new MD2Digest();
case HashAlgorithmTags.MD5:
return new MD5Digest();
case HashAlgorithmTags.RIPEMD160:
return new RIPEMD160Digest();
case HashAlgorithmTags.TIGER_192:
return new TigerDigest();
default:
throw new PGPException("cannot recognise digest");
}
}
示例14: initDigesters
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
private static void initDigesters() {
digesters.put("Blake2b", Blake2bDigest.class);
digesters.put("GOST3411", GOST3411Digest.class);
digesters.put("Keccak", KeccakDigest.class);
digesters.put("MD2", MD2Digest.class);
digesters.put("MD4", MD4Digest.class);
digesters.put("MD5", MD5Digest.class);
digesters.put("RIPEMD128", RIPEMD128Digest.class);
digesters.put("RIPEMD160", RIPEMD160Digest.class);
digesters.put("RIPEMD256", RIPEMD256Digest.class);
digesters.put("RIPEMD320", RIPEMD320Digest.class);
digesters.put("SHA1", SHA1Digest.class);
digesters.put("SHA224", SHA224Digest.class);
digesters.put("SHA256", SHA256Digest.class);
digesters.put("SHA384", SHA384Digest.class);
digesters.put("SHA3-512", SHA3Digest.class);
digesters.put("SHA3-256", SHA3Digest.class);
digesters.put("SHA3-224", SHA3Digest.class);
digesters.put("SHA3-384", SHA3Digest.class);
digesters.put("SHA512", SHA512Digest.class);
digesters.put("SHAKE-128", SHAKEDigest.class);
digesters.put("SHAKE-256", SHAKEDigest.class);
digesters.put("Skein256", SkeinDigest.class);
digesters.put("Skein512", SkeinDigest.class);
digesters.put("Skein1024", SkeinDigest.class);
digesters.put("SM3", SM3Digest.class);
digesters.put("Tiger", TigerDigest.class);
digesters.put("Whirlpool", WhirlpoolDigest.class);
}
示例15: getDigest
import org.bouncycastle.crypto.digests.SHA384Digest; //导入依赖的package包/类
public static Digest getDigest(
String digestName)
{
digestName = Strings.toUpperCase(digestName);
if (sha1.contains(digestName))
{
return new SHA1Digest();
}
if (md5.contains(digestName))
{
return new MD5Digest();
}
if (sha224.contains(digestName))
{
return new SHA224Digest();
}
if (sha256.contains(digestName))
{
return new SHA256Digest();
}
if (sha384.contains(digestName))
{
return new SHA384Digest();
}
if (sha512.contains(digestName))
{
return new SHA512Digest();
}
if (sha512_224.contains(digestName))
{
return new SHA512tDigest(224);
}
if (sha512_256.contains(digestName))
{
return new SHA512tDigest(256);
}
return null;
}