Adjust to new API

This commit is contained in:
Paul Schaub 2025-01-02 15:44:49 +01:00
parent eca3ad56b8
commit f916ac2871
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -1,7 +1,6 @@
package org.pgpainless.bouncycastle.sop.operation;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.api.OpenPGPKey;
import org.bouncycastle.openpgp.api.OpenPGPV6KeyGenerator;
import org.bouncycastle.openpgp.api.bc.BcOpenPGPV6KeyGenerator;
@ -32,19 +31,22 @@ public class BCGenerateKey
@Override
public void writeTo(@NotNull OutputStream outputStream) throws IOException
{
OpenPGPV6KeyGenerator generator = new BcOpenPGPV6KeyGenerator(new Date());
OpenPGPV6KeyGenerator generator = null;
try {
generator = new BcOpenPGPV6KeyGenerator(new Date());
} catch (PGPException e) {
throw new RuntimeException(e);
}
OpenPGPKey key;
try
{
if (signOnly)
{
PGPSecretKeyRing keyRing = generator.signOnlyKey(passphrase);
key = new OpenPGPKey(keyRing);
key = generator.signOnlyKey(passphrase);
}
else
{
PGPSecretKeyRing keyRing = generator.ed25519x25519Key(userId, passphrase);
key = new OpenPGPKey(keyRing);
key = generator.ed25519x25519Key(userId, passphrase);
}
}
catch (PGPException e)