Java 类org.bouncycastle.openpgp.operator.bc.BcPBEKeyEncryptionMethodGenerator 实例源码

项目:jpgpj    文件:Encryptor.java   
/**
 * Builds a PublicKeyKeyEncryptionMethodGenerator
 * for the specified key.
 */
protected PBEKeyEncryptionMethodGenerator buildSymmetricKeyEncryptor()
throws PGPException {
    if (log.isLoggable(Level.INFO))
        log.info("using symmetric encryption with " +
            keyDerivationAlgorithm + " hash, work factor " +
            keyDerivationWorkFactor);

    int algo = keyDerivationAlgorithm.ordinal();
    return new BcPBEKeyEncryptionMethodGenerator(
        symmetricPassphrase.toCharArray(),
        new BcPGPDigestCalculatorProvider().get(algo),
        keyDerivationWorkFactor);
}