mirror of
https://codeberg.org/PGPainless/bc-sop.git
synced 2025-09-08 18:59:41 +02:00
Adjust to new API
This commit is contained in:
parent
eca3ad56b8
commit
f916ac2871
1 changed files with 8 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue