• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java EACSignatureVerifier类的典型用法和代码示例

java 1次浏览

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

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

示例1: isSignatureValid

点赞 3

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public boolean isSignatureValid(EACSignatureVerifier verifier)
    throws EACException
{
    try
    {
        OutputStream vOut = verifier.getOutputStream();

        vOut.write(cvCertificate.getBody().getEncoded(ASN1Encoding.DER));

        vOut.close();

        return verifier.verify(cvCertificate.getSignature());
    }
    catch (Exception e)
    {
        throw new EACException("unable to process signature: " + e.getMessage(), e);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:19,
代码来源:EACCertificateHolder.java

示例2: isInnerSignatureValid

点赞 3

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public boolean isInnerSignatureValid(EACSignatureVerifier verifier)
    throws EACException
{
    try
    {
        OutputStream vOut = verifier.getOutputStream();

        vOut.write(request.getCertificateBody().getEncoded(ASN1Encoding.DER));

        vOut.close();

        return verifier.verify(request.getInnerSignature());
    }
    catch (Exception e)
    {
        throw new EACException("unable to process signature: " + e.getMessage(), e);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:19,
代码来源:EACCertificateRequestHolder.java

示例3: testLoadCertificate

点赞 2

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public void testLoadCertificate() throws Exception
{
    EACCertificateHolder certHolder = new EACCertificateHolder(getInput("Belgique CVCA-02032010.7816.cvcert"));

    PublicKey pubKey = new JcaPublicKeyConverter().setProvider(BC).getKey(certHolder.getPublicKeyDataObject());
    EACSignatureVerifier verifier = new JcaEACSignatureVerifierBuilder().build(certHolder.getPublicKeyDataObject().getUsage(), pubKey);

    if (!certHolder.isSignatureValid(verifier))
    {
        fail("signature test failed");
    }
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:13,
代码来源:AllTests.java

示例4: testLoadInvalidRequest

点赞 2

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public void testLoadInvalidRequest() throws Exception
{
    // this request contains invalid unsigned integers (see D 2.1.1)
    EACCertificateRequestHolder requestHolder = new EACCertificateRequestHolder(getInput("REQ_18102010.csr"));

    PublicKey pubKey = new JcaPublicKeyConverter().setProvider(BC).getKey(requestHolder.getPublicKeyDataObject());
    EACSignatureVerifier verifier = new JcaEACSignatureVerifierBuilder().build(requestHolder.getPublicKeyDataObject().getUsage(), pubKey);

    if (requestHolder.isInnerSignatureValid(verifier))
    {
        fail("signature test failed");
    }
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:14,
代码来源:AllTests.java

示例5: testGenerateEC

点赞 2

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public void testGenerateEC()
    throws Exception
{
    ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1");
    KeyPair kp = generateECKeyPair(ecSpec);

    JcaEACSignerBuilder signerBuilder = new JcaEACSignerBuilder().setProvider(BC);

    EACSigner signer = signerBuilder.build("SHA256withECDSA", kp.getPrivate());

    int role = CertificateHolderAuthorization.CVCA;
    int rights = CertificateHolderAuthorization.RADG3 | CertificateHolderAuthorization.RADG4;

    EACCertificateBuilder certBuilder = new EACCertificateBuilder(
        new CertificationAuthorityReference("AU", "BC TEST", "12345"),
        new JcaPublicKeyConverter().getPublicKeyDataObject(signer.getUsageIdentifier(), kp.getPublic()),
        new CertificateHolderReference("AU", "BC TEST", "12345"),
        new CertificateHolderAuthorization(EACObjectIdentifiers.id_EAC_ePassport, role | rights),
        new PackedDate("110101"),
        new PackedDate("120101"));

    EACCertificateHolder certHolder = certBuilder.build(signer);

    EACSignatureVerifier verifier = new JcaEACSignatureVerifierBuilder().build(certHolder.getPublicKeyDataObject().getUsage(), kp.getPublic());

    if (!certHolder.isSignatureValid(verifier))
    {
        fail("first signature test failed");
    }

    PublicKey pubKey = new JcaPublicKeyConverter().setProvider(BC).getKey(certHolder.getPublicKeyDataObject());
    verifier = new JcaEACSignatureVerifierBuilder().build(certHolder.getPublicKeyDataObject().getUsage(), pubKey);

    if (!certHolder.isSignatureValid(verifier))
    {
        fail("first signature test failed");
    }
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:39,
代码来源:AllTests.java

示例6: testGenerateRSA

点赞 2

import org.bouncycastle.eac.operator.EACSignatureVerifier; //导入依赖的package包/类
public void testGenerateRSA()
    throws Exception
{
    KeyPair kp = generateRSAKeyPair();

    JcaEACSignerBuilder signerBuilder = new JcaEACSignerBuilder().setProvider(BC);

    EACSigner signer = signerBuilder.build("SHA256withRSA", kp.getPrivate());

    int role = CertificateHolderAuthorization.CVCA;
    int rights = CertificateHolderAuthorization.RADG3 | CertificateHolderAuthorization.RADG4;

    EACCertificateBuilder certBuilder = new EACCertificateBuilder(
        new CertificationAuthorityReference("AU", "BC TEST", "12345"),
        new JcaPublicKeyConverter().getPublicKeyDataObject(signer.getUsageIdentifier(), kp.getPublic()),
        new CertificateHolderReference("AU", "BC TEST", "12345"),
        new CertificateHolderAuthorization(EACObjectIdentifiers.id_EAC_ePassport, role | rights),
        new PackedDate("110101"),
        new PackedDate("120101"));

    EACCertificateHolder certHolder = certBuilder.build(signer);

    EACSignatureVerifier verifier = new JcaEACSignatureVerifierBuilder().build(certHolder.getPublicKeyDataObject().getUsage(), kp.getPublic());

    if (!certHolder.isSignatureValid(verifier))
    {
        fail("first signature test failed");
    }

    PublicKey pubKey = new JcaPublicKeyConverter().setProvider(BC).getKey(certHolder.getPublicKeyDataObject());
    verifier = new JcaEACSignatureVerifierBuilder().build(certHolder.getPublicKeyDataObject().getUsage(), pubKey);

    if (!certHolder.isSignatureValid(verifier))
    {
        fail("first signature test failed");
    }
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:38,
代码来源:AllTests.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)