Java 类org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder 实例源码

项目:base    文件:PGPEncryptionUtil.java   
private static PGPLiteralData asLiteral( final byte[] message, final InputStream secretKeyRing,
                                         final String secretPwd ) throws IOException, PGPException
{
    PGPPrivateKey key = null;
    PGPPublicKeyEncryptedData encrypted = null;
    final PGPSecretKeyRingCollection keys =
            new PGPSecretKeyRingCollection( PGPUtil.getDecoderStream( secretKeyRing ),
                    new JcaKeyFingerprintCalculator() );
    for ( final Iterator<PGPPublicKeyEncryptedData> i = getEncryptedObjects( message );
          ( key == null ) && i.hasNext(); )
    {
        encrypted = i.next();
        key = getPrivateKey( keys, encrypted.getKeyID(), secretPwd );
    }
    if ( key == null )
    {
        throw new IllegalArgumentException( "secret key for message not found." );
    }
    final InputStream stream = encrypted
            .getDataStream( new JcePublicKeyDataDecryptorFactoryBuilder().setProvider( provider ).build( key ) );
    return asLiteral( stream );
}
项目:izettle-toolbox    文件:PGP.java   
private static PGPLiteralData asLiteral(
        final byte[] data,
        final InputStream keyfile,
        final String passphrase) throws IOException, PGPException {
    PGPPrivateKey key = null;
    PGPPublicKeyEncryptedData encrypted = null;
    final PGPSecretKeyRingCollection keys =
        new PGPSecretKeyRingCollection(new ArmoredInputStream(keyfile), new BcKeyFingerprintCalculator());
    for (final Iterator<PGPPublicKeyEncryptedData> i = getEncryptedObjects(data); key == null && i.hasNext();) {
        encrypted = i.next();
        key = findSecretKey(keys, encrypted.getKeyID(), passphrase);
    }
    if (key == null) {
        throw new IllegalArgumentException("secret key for message not found.");
    }
    final InputStream stream = encrypted.getDataStream(
            new JcePublicKeyDataDecryptorFactoryBuilder()
                .setProvider(PROVIDER)
                    .build(key));
    return asLiteral(stream);
}
项目:CryptMeme    文件:PGPPublicKeyEncryptedData.java   
/**
 *
 * @deprecated use the method taking a PublicKeyDataDecryptorFactory
 */
public int getSymmetricAlgorithm(
    PGPPrivateKey  privKey,
    Provider       provider)
    throws PGPException, NoSuchProviderException
{
    return getSymmetricAlgorithm(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(provider).setContentProvider(provider).build(privKey));
}
项目:CryptMeme    文件:PGPPublicKeyEncryptedData.java   
/**
 *  @deprecated use method that takes a PublicKeyDataDecryptorFactory
 */
public InputStream getDataStream(
    PGPPrivateKey  privKey,
    Provider       asymProvider,
    Provider       provider)
    throws PGPException
{
    return getDataStream(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(asymProvider).setContentProvider(provider).build(privKey));
}
项目:irma_future_id    文件:PGPPublicKeyEncryptedData.java   
/**
 *
 * @deprecated use the method taking a PublicKeyDataDecryptorFactory
 */
public int getSymmetricAlgorithm(
    PGPPrivateKey  privKey,
    Provider       provider)
    throws PGPException, NoSuchProviderException
{
    return getSymmetricAlgorithm(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(provider).setContentProvider(provider).build(privKey));
}
项目:irma_future_id    文件:PGPPublicKeyEncryptedData.java   
/**
 *  @deprecated use method that takes a PublicKeyDataDecryptorFactory
 */
public InputStream getDataStream(
    PGPPrivateKey  privKey,
    Provider       asymProvider,
    Provider       provider)
    throws PGPException
{
    return getDataStream(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(asymProvider).setContentProvider(provider).build(privKey));
}
项目:bc-java    文件:PGPPublicKeyEncryptedData.java   
/**
 *
 * @deprecated use the method taking a PublicKeyDataDecryptorFactory
 */
public int getSymmetricAlgorithm(
    PGPPrivateKey  privKey,
    Provider       provider)
    throws PGPException, NoSuchProviderException
{
    return getSymmetricAlgorithm(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(provider).setContentProvider(provider).build(privKey));
}
项目:bc-java    文件:PGPPublicKeyEncryptedData.java   
/**
 *  @deprecated use method that takes a PublicKeyDataDecryptorFactory
 */
public InputStream getDataStream(
    PGPPrivateKey  privKey,
    Provider       asymProvider,
    Provider       provider)
    throws PGPException
{
    return getDataStream(new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(asymProvider).setContentProvider(provider).build(privKey));
}
项目:base    文件:PGPDecrypt.java   
private static InputStream getInputStream( PGPPrivateKey privateKey, PGPPublicKeyEncryptedData pgpEncData )
        throws PGPException, IOException
{
    InputStream is = pgpEncData
            .getDataStream( new JcePublicKeyDataDecryptorFactoryBuilder().setProvider( "BC" ).build( privateKey ) );

    JcaPGPObjectFactory objectFactory = new JcaPGPObjectFactory( is );

    Object message = objectFactory.nextObject();

    PGPCompressedData compressedData = ( PGPCompressedData ) message;

    JcaPGPObjectFactory pgpObjectFactory = new JcaPGPObjectFactory( compressedData.getDataStream() );

    PGPLiteralData literalData = ( PGPLiteralData ) pgpObjectFactory.nextObject();

    return literalData.getInputStream();
}