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


Java PGPUtil.setDefaultProvider方法代码示例

本文整理汇总了Java中org.bouncycastle.openpgp.PGPUtil.setDefaultProvider方法的典型用法代码示例。如果您正苦于以下问题:Java PGPUtil.setDefaultProvider方法的具体用法?Java PGPUtil.setDefaultProvider怎么用?Java PGPUtil.setDefaultProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.openpgp.PGPUtil的用法示例。


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

示例1: performTest

import org.bouncycastle.openpgp.PGPUtil; //导入方法依赖的package包/类
public void performTest()
    throws Exception
{
    PGPUtil.setDefaultProvider("BC");

    //
    // Read the public key
    //
    PGPPublicKeyRing        pubKeyRing = new PGPPublicKeyRing(testPubKey, new JcaKeyFingerprintCalculator());

    doBasicKeyRingCheck(pubKeyRing);

    //
    // Read the private key
    //
    PGPSecretKeyRing        secretKeyRing = new PGPSecretKeyRing(testPrivKey, new JcaKeyFingerprintCalculator());

    testDecrypt(secretKeyRing);

    encryptDecryptTest();

    generate();
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:24,代码来源:PGPECDHTest.java

示例2: performTest

import org.bouncycastle.openpgp.PGPUtil; //导入方法依赖的package包/类
public void performTest()
    throws Exception
{
    PGPUtil.setDefaultProvider("BC");

    //
    // Read the public key
    //
    PGPPublicKeyRing        pubKeyRing = new PGPPublicKeyRing(testPubKey, new JcaKeyFingerprintCalculator());

    doBasicKeyRingCheck(pubKeyRing);

    //
    // Read the private key
    //
    PGPSecretKeyRing        secretKeyRing = new PGPSecretKeyRing(testPrivKey, new JcaKeyFingerprintCalculator());

    generate();
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:20,代码来源:PGPECDHTest.java

示例3: performTest

import org.bouncycastle.openpgp.PGPUtil; //导入方法依赖的package包/类
public void performTest()
    throws Exception
{
    PGPUtil.setDefaultProvider("BC");

    //
    // Read the public key
    //
    PGPPublicKeyRing        pubKeyRing = new PGPPublicKeyRing(testPubKey, new JcaKeyFingerprintCalculator());

    for (Iterator it = pubKeyRing.getPublicKey().getSignatures(); it.hasNext();)
    {
        PGPSignature certification = (PGPSignature)it.next();

        certification.init(new JcaPGPContentVerifierBuilderProvider().setProvider("BC"), pubKeyRing.getPublicKey());

        if (!certification.verifyCertification((String)pubKeyRing.getPublicKey().getUserIDs().next(), pubKeyRing.getPublicKey()))
        {
            fail("self certification does not verify");
        }
    }

    //
    // Read the private key
    //
    PGPSecretKeyRing        secretKeyRing = new PGPSecretKeyRing(testPrivKey, new JcaKeyFingerprintCalculator());


    generateAndSign();
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:31,代码来源:PGPECDSATest.java

示例4: main

import org.bouncycastle.openpgp.PGPUtil; //导入方法依赖的package包/类
public static void main(String[] args)
    throws Exception
{
    Security.addProvider(new BouncyCastleProvider());
    
    PGPUtil.setDefaultProvider("BC");

    //
    // Read the public key rings
    //
    PGPPublicKeyRingCollection    pubRings = new PGPPublicKeyRingCollection(
        PGPUtil.getDecoderStream(new FileInputStream(args[0])));

    Iterator    rIt = pubRings.getKeyRings();
        
    while (rIt.hasNext())
    {
        PGPPublicKeyRing    pgpPub = (PGPPublicKeyRing)rIt.next();

        try
        {
            pgpPub.getPublicKey();
        }
        catch (Exception e)
        {
            e.printStackTrace();
            continue;
        }

        Iterator    it = pgpPub.getPublicKeys();
        boolean     first = true;
        while (it.hasNext())
        {
            PGPPublicKey    pgpKey = (PGPPublicKey)it.next();

            if (first)
            {
                System.out.println("Key ID: " + Long.toHexString(pgpKey.getKeyID()));
                first = false;
            }
            else
            {
                System.out.println("Key ID: " + Long.toHexString(pgpKey.getKeyID()) + " (subkey)");
            }
            System.out.println("            Algorithm: " + getAlgorithm(pgpKey.getAlgorithm()));
            System.out.println("            Fingerprint: " + new String(Hex.encode(pgpKey.getFingerprint())));
        }
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:50,代码来源:PubringDump.java


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