io.trbl.bcpg.BcPGPPublicKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-simple-jdk15on Show documentation
Show all versions of bcpg-simple-jdk15on Show documentation
A simple, lightweight wrapper around BouncyCastle's OpenPGP support.
The newest version!
package io.trbl.bcpg;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.openpgp.PGPPublicKey;
class BcPGPPublicKey implements PublicKey {
private final PGPPublicKey publicKey;
public BcPGPPublicKey(final PGPPublicKey publicKey) {
this.publicKey = publicKey;
}
public String toArmoredString() {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final ArmoredOutputStream armoredStream = new ArmoredOutputStream(outputStream);
final BufferedOutputStream bufferedStream = new BufferedOutputStream(armoredStream);
try {
publicKey.encode(bufferedStream);
bufferedStream.close();
}
catch (final IOException e) {
}
return outputStream.toString();
}
public byte[] getFingerprint() {
return publicKey.getFingerprint();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy