mirror of
https://codeberg.org/PGPainless/bc-sop.git
synced 2025-09-09 03:09:40 +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;
|
package org.pgpainless.bouncycastle.sop.operation;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
|
||||||
import org.bouncycastle.openpgp.api.OpenPGPKey;
|
import org.bouncycastle.openpgp.api.OpenPGPKey;
|
||||||
import org.bouncycastle.openpgp.api.OpenPGPV6KeyGenerator;
|
import org.bouncycastle.openpgp.api.OpenPGPV6KeyGenerator;
|
||||||
import org.bouncycastle.openpgp.api.bc.BcOpenPGPV6KeyGenerator;
|
import org.bouncycastle.openpgp.api.bc.BcOpenPGPV6KeyGenerator;
|
||||||
|
@ -32,19 +31,22 @@ public class BCGenerateKey
|
||||||
@Override
|
@Override
|
||||||
public void writeTo(@NotNull OutputStream outputStream) throws IOException
|
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;
|
OpenPGPKey key;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (signOnly)
|
if (signOnly)
|
||||||
{
|
{
|
||||||
PGPSecretKeyRing keyRing = generator.signOnlyKey(passphrase);
|
key = generator.signOnlyKey(passphrase);
|
||||||
key = new OpenPGPKey(keyRing);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PGPSecretKeyRing keyRing = generator.ed25519x25519Key(userId, passphrase);
|
key = generator.ed25519x25519Key(userId, passphrase);
|
||||||
key = new OpenPGPKey(keyRing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PGPException e)
|
catch (PGPException e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue