本文整理汇总了Java中org.bouncycastle.asn1.x509.DigestInfo.getEncoded方法的典型用法代码示例。如果您正苦于以下问题:Java DigestInfo.getEncoded方法的具体用法?Java DigestInfo.getEncoded怎么用?Java DigestInfo.getEncoded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.x509.DigestInfo
的用法示例。
在下文中一共展示了DigestInfo.getEncoded方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: derEncode
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
private byte[] derEncode(
byte[] hash)
throws IOException
{
DigestInfo dInfo = new DigestInfo(algId, hash);
return dInfo.getEncoded(ASN1Encoding.DER);
}
示例2: derEncode
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
private byte[] derEncode(
byte[] hash)
throws IOException
{
if (algId == null)
{
// For raw RSA, the DigestInfo must be prepared externally
return hash;
}
DigestInfo dInfo = new DigestInfo(algId, hash);
return dInfo.getEncoded(ASN1Encoding.DER);
}
示例3: derEncode
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
private byte[] derEncode(byte[] hash) throws IOException {
if (digestAlgId == null) {
// For raw RSA, the DigestInfo must be prepared externally
return hash;
}
DigestInfo digestInfo = new DigestInfo(digestAlgId, hash);
return digestInfo.getEncoded(ASN1Encoding.DER);
}
示例4: digestInfoSha256
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoSha256() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = NISTObjectIdentifiers.id_sha256;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例5: digestInfoSha384
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的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)));
}
示例6: digestInfoSha512
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoSha512() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("SHA-512");
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = NISTObjectIdentifiers.id_sha512;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例7: digestInfoSha224
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoSha224() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("SHA-224", new BouncyCastleProvider());
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = NISTObjectIdentifiers.id_sha224;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例8: digestInfoRipemd160
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoRipemd160() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("RIPEMD160", new BouncyCastleProvider());
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = X509ObjectIdentifiers.ripemd160;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例9: digestInfoRipemd128
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoRipemd128() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("RIPEMD128", new BouncyCastleProvider());
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = TeleTrusTObjectIdentifiers.ripemd128;
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例10: digestInfoRipemd256
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
@Test
public void digestInfoRipemd256() throws Exception {
byte[] message = "hello world".getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("RIPEMD256", new BouncyCastleProvider());
byte[] digest = messageDigest.digest(message);
LOG.debug("Digest: " + new String(Hex.encodeHex(digest)));
DERObjectIdentifier hashAlgoId = new DERObjectIdentifier("1.3.36.3.2.3");
DigestInfo digestInfo = new DigestInfo(new AlgorithmIdentifier(hashAlgoId, DERNull.INSTANCE), digest);
byte[] encodedDigestInfo = digestInfo.getEncoded();
LOG.debug("Digest Info: " + new String(Hex.encodeHex(encodedDigestInfo)));
}
示例11: derEncode
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
private byte[] derEncode(ASN1ObjectIdentifier oid, byte[] hash) throws IOException
{
AlgorithmIdentifier algId = new AlgorithmIdentifier(oid, DERNull.INSTANCE);
DigestInfo dInfo = new DigestInfo(algId, hash);
return dInfo.getEncoded(ASN1Encoding.DER);
}
示例12: derEncode
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
private byte[] derEncode(
byte[] hash)
throws IOException
{
if (algId == null)
{
// For raw RSA, the DigestInfo must be prepared externally
return hash;
}
DigestInfo dInfo = new DigestInfo(algId, hash);
return dInfo.getEncoded(ASN1Encodable.DER);
}
示例13: encodeDigest
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
public static byte[] encodeDigest(DigestInfo dInfo) throws IOException {
return dInfo.getEncoded(DER);
}
示例14: encodeDigest
import org.bouncycastle.asn1.x509.DigestInfo; //导入方法依赖的package包/类
public static byte[] encodeDigest(DigestInfo dInfo) throws IOException {
return dInfo.getEncoded(ASN1Encoding.DER);
}