当前位置: 首页>>代码示例>>Java>>正文


Java DigestInfo类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.x509.DigestInfo的典型用法代码示例。如果您正苦于以下问题:Java DigestInfo类的具体用法?Java DigestInfo怎么用?Java DigestInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DigestInfo类属于org.bouncycastle.asn1.x509包,在下文中一共展示了DigestInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MacData

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
private MacData(
    ASN1Sequence seq)
{
    this.digInfo = DigestInfo.getInstance(seq.getObjectAt(0));

    this.salt = ((ASN1OctetString)seq.getObjectAt(1)).getOctets();

    if (seq.size() == 3)
    {
        this.iterationCount = ((ASN1Integer)seq.getObjectAt(2)).getValue();
    }
    else
    {
        this.iterationCount = ONE;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:MacData.java

示例2: getInstance

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public static Data getInstance(Object obj)
{
    if (obj instanceof Data)
    {
        return (Data)obj;
    }
    else if (obj instanceof ASN1OctetString)
    {
        return new Data((ASN1OctetString)obj);
    }
    else if (obj instanceof ASN1Sequence)
    {
        return new Data(DigestInfo.getInstance(obj));
    }
    else if (obj instanceof ASN1TaggedObject)
    {
        return new Data(ASN1Sequence.getInstance((ASN1TaggedObject)obj, false));
    }
    throw new IllegalArgumentException("Unknown object submitted to getInstance: " + obj.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:Data.java

示例3: DVCSCertInfo

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public DVCSCertInfo(
    DVCSRequestInformation dvReqInfo,
    DigestInfo messageImprint,
    ASN1Integer serialNumber,
    DVCSTime responseTime)
{
    this.dvReqInfo = dvReqInfo;
    this.messageImprint = messageImprint;
    this.serialNumber = serialNumber;
    this.responseTime = responseTime;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:DVCSCertInfo.java

示例4: OtherCertID

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
/**
 * constructor
 */
private OtherCertID(ASN1Sequence seq)
{
    if (seq.size() < 1 || seq.size() > 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
    }

    if (seq.getObjectAt(0).toASN1Primitive() instanceof ASN1OctetString)
    {
        otherCertHash = ASN1OctetString.getInstance(seq.getObjectAt(0));
    }
    else
    {
        otherCertHash = DigestInfo.getInstance(seq.getObjectAt(0));

    }

    if (seq.size() > 1)
    {
        issuerSerial = IssuerSerial.getInstance(seq.getObjectAt(1));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:OtherCertID.java

示例5: build

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public MessageImprint build(byte[] message)
    throws DVCSException
{
    try
    {
        OutputStream dOut = digestCalculator.getOutputStream();

        dOut.write(message);

        dOut.close();

        return new MessageImprint(new DigestInfo(digestCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest()));
    }
    catch (Exception e)
    {
        throw new DVCSException("unable to build MessageImprint: " + e.getMessage(), e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:MessageImprintBuilder.java

示例6: MacData

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public MacData(
    ASN1Sequence seq)
{
    this.digInfo = DigestInfo.getInstance(seq.getObjectAt(0));

    this.salt = ((ASN1OctetString)seq.getObjectAt(1)).getOctets();

    if (seq.size() == 3)
    {
        this.iterationCount = ((DERInteger)seq.getObjectAt(2)).getValue();
    }
    else
    {
        this.iterationCount = BigInteger.valueOf(1);
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:17,代码来源:MacData.java

示例7: testPlainTextAuthn

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
@Test
@QualityAssurance(firmware = Firmware.V015Z, approved = true)
public void testPlainTextAuthn() throws Exception {
	// operate
	String testMessage = "Test Application @ 14/2/2012 14:48:21";
	byte[] signatureValue = this.pcscEid.sign(testMessage.getBytes(), "2.16.56.1.2.1.3.1", (byte) 0x82, false);

	// verify
	List<X509Certificate> authnCertChain = this.pcscEid.getAuthnCertificateChain();

	Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
	cipher.init(Cipher.DECRYPT_MODE, authnCertChain.get(0));
	byte[] signatureDigestInfoValue = cipher.doFinal(signatureValue);
	ASN1InputStream aIn = new ASN1InputStream(signatureDigestInfoValue);
	DigestInfo signatureDigestInfo = new DigestInfo((ASN1Sequence) aIn.readObject());
	LOG.debug("result algo Id: " + signatureDigestInfo.getAlgorithmId().getObjectId().getId());
	assertEquals("2.16.56.1.2.1.3.1", signatureDigestInfo.getAlgorithmId().getObjectId().getId());
	assertArrayEquals(testMessage.getBytes(), signatureDigestInfo.getDigest());
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:20,代码来源:SecurePinPadReaderTest.java

示例8: __verifyNonRepSignature

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
private boolean __verifyNonRepSignature(final byte[] expectedDigestValue, final byte[] signatureValue,
		final X509Certificate certificate) throws NoSuchAlgorithmException, NoSuchPaddingException,
		InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException {
	final PublicKey publicKey = certificate.getPublicKey();

	final Cipher cipher = Cipher.getInstance("RSA");
	cipher.init(Cipher.DECRYPT_MODE, publicKey);
	final byte[] actualSignatureDigestInfoValue = cipher.doFinal(signatureValue);

	final ASN1InputStream asnInputStream = new ASN1InputStream(actualSignatureDigestInfoValue);
	final DigestInfo actualSignatureDigestInfo = new DigestInfo((ASN1Sequence) asnInputStream.readObject());
	asnInputStream.close();

	final byte[] actualDigestValue = actualSignatureDigestInfo.getDigest();
	return Arrays.equals(expectedDigestValue, actualDigestValue);
}
 
开发者ID:e-Contract,项目名称:commons-eid,代码行数:17,代码来源:BeIDIntegrity.java

示例9: computeProxy

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
/**
 * Compute the content proxy for a given node. This should likely move somewhere else
 * @param nodeContent the content stored at this node
 * @param isDigest is the content already digested
 * @return the proxy digest (for example, the computed root of the Merkle hash tree) for this node
 * @throws CertificateEncodingException if we cannot decode the witness
 */
public byte[] computeProxy(byte[] nodeContent, boolean isDigest) throws CertificateEncodingException {
	if (null == witness())
		return null;
	
	DigestInfo info = CCNDigestHelper.digestDecoder(witness());
	
	byte [] proxy = null;
	
	if (MerklePath.isMerklePath(info)) {
		MerklePath mp = new MerklePath(info.getDigest());
		proxy = mp.root(nodeContent, isDigest);
	} else {
		Log.warning("Unexpected witness type: " + info.getAlgorithmId().toString());
	}
	return proxy;
}
 
开发者ID:StefanoSalsano,项目名称:alien-ofelia-conet-ccnx,代码行数:24,代码来源:Signature.java

示例10: build

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public MacData build(char[] password, byte[] data)
    throws PKCSException
{
    MacCalculator     macCalculator;

    try
    {
        macCalculator = builder.build(password);

        OutputStream out = macCalculator.getOutputStream();

        out.write(data);

        out.close();
    }
    catch (Exception e)
    {
        throw new PKCSException("unable to process data: " + e.getMessage(), e);
    }

    AlgorithmIdentifier algId = macCalculator.getAlgorithmIdentifier();

    DigestInfo dInfo = new DigestInfo(builder.getDigestAlgorithmIdentifier(), macCalculator.getMac());
    PKCS12PBEParams params = PKCS12PBEParams.getInstance(algId.getParameters());

    return new MacData(dInfo, params.getIV(), params.getIterations().intValue());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:MacDataGenerator.java

示例11: 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);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:RSADigestSigner.java

示例12: DVCSCertInfoBuilder

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public DVCSCertInfoBuilder(
    DVCSRequestInformation dvReqInfo,
    DigestInfo messageImprint,
    ASN1Integer serialNumber,
    DVCSTime responseTime)
{
    this.dvReqInfo = dvReqInfo;
    this.messageImprint = messageImprint;
    this.serialNumber = serialNumber;
    this.responseTime = responseTime;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:DVCSCertInfoBuilder.java

示例13: getAlgorithmHash

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public AlgorithmIdentifier getAlgorithmHash()
{
    if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString)
    {
        // SHA-1
        return new AlgorithmIdentifier("1.3.14.3.2.26");
    }
    else
    {
        return DigestInfo.getInstance(otherCertHash).getAlgorithmId();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:OtherCertID.java

示例14: getCertHash

import org.bouncycastle.asn1.x509.DigestInfo; //导入依赖的package包/类
public byte[] getCertHash()
{
    if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString)
    {
        // SHA-1
        return ((ASN1OctetString)otherCertHash.toASN1Primitive()).getOctets();
    }
    else
    {
        return DigestInfo.getInstance(otherCertHash).getDigest();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:OtherCertID.java

示例15: 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);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:DigestSignatureSpi.java


注:本文中的org.bouncycastle.asn1.x509.DigestInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。