2018-06-02 21:21:35 +02:00
|
|
|
package de.vanitasvitae.crypto.pgpainless;
|
|
|
|
|
2018-06-05 01:30:58 +02:00
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2018-06-04 14:50:09 +02:00
|
|
|
import de.vanitasvitae.crypto.pgpainless.decryption_verification.DecryptionBuilder;
|
|
|
|
import de.vanitasvitae.crypto.pgpainless.encryption_signing.EncryptionBuilder;
|
2018-06-02 21:21:35 +02:00
|
|
|
import de.vanitasvitae.crypto.pgpainless.key.generation.KeyRingBuilder;
|
2018-06-05 01:30:58 +02:00
|
|
|
import org.bouncycastle.bcpg.ArmoredInputStream;
|
|
|
|
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
|
|
|
import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
|
2018-06-02 21:21:35 +02:00
|
|
|
|
|
|
|
public class PGPainless {
|
|
|
|
|
|
|
|
public static KeyRingBuilder generateKeyRing() {
|
|
|
|
return new KeyRingBuilder();
|
|
|
|
}
|
2018-06-04 14:50:09 +02:00
|
|
|
|
|
|
|
public static EncryptionBuilder createEncryptor() {
|
|
|
|
return new EncryptionBuilder();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static DecryptionBuilder createDecryptor() {
|
|
|
|
return new DecryptionBuilder();
|
|
|
|
}
|
|
|
|
|
2018-06-05 01:30:58 +02:00
|
|
|
public static PGPPublicKeyRing publicKeyRingFromBytes(byte[] bytes) throws IOException {
|
|
|
|
return new PGPPublicKeyRing(new ArmoredInputStream(new ByteArrayInputStream(bytes)), new BcKeyFingerprintCalculator());
|
|
|
|
}
|
2018-06-02 21:21:35 +02:00
|
|
|
}
|