mirror of
https://codeberg.org/PGPainless/cert-d-pgpainless.git
synced 2025-12-05 04:41:09 +01:00
Upgrade build system and depdencies
This commit is contained in:
parent
f061b076dc
commit
540dca6a24
11 changed files with 48 additions and 71 deletions
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
plugins {
|
||||
id 'application'
|
||||
id "com.github.johnrengelman.shadow" version "6.1.0"
|
||||
id 'com.gradleup.shadow' version '8.3.6'
|
||||
}
|
||||
|
||||
group 'org.pgpainless'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -19,7 +20,8 @@ dependencies {
|
|||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||
|
||||
// Logging
|
||||
implementation ("org.slf4j:slf4j-nop:$slf4jVersion")
|
||||
// implementation ("org.slf4j:slf4j-nop:$slf4jVersion")
|
||||
implementation "ch.qos.logback:logback-classic:$logbackVersion"
|
||||
|
||||
// pgp.cert.d using PGPainless
|
||||
implementation project(":pgpainless-cert-d")
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package pgp.cert_d.cli.commands;
|
|||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.key.OpenPgpFingerprint;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.pgpainless.certificate_store.MergeCallbacks;
|
||||
|
|
@ -30,21 +31,22 @@ public class Import implements Runnable {
|
|||
PGPPublicKeyRingCollection certificates = PGPainless.readKeyRing().publicKeyRingCollection(System.in);
|
||||
for (PGPPublicKeyRing cert : certificates) {
|
||||
ByteArrayInputStream certIn = new ByteArrayInputStream(cert.getEncoded());
|
||||
Certificate certificate = PGPCertDCli.getCertificateDirectory()
|
||||
.insert(certIn, MergeCallbacks.mergeWithExisting());
|
||||
// CHECKSTYLE:OFF
|
||||
System.out.println(certificate.getFingerprint());
|
||||
// CHECKSTYLE:ON
|
||||
try {
|
||||
Certificate certificate = PGPCertDCli.getCertificateDirectory()
|
||||
.insert(certIn, MergeCallbacks.mergeWithExisting());
|
||||
LOGGER.info(certificate.getFingerprint());
|
||||
} catch (BadDataException e) {
|
||||
LOGGER.error("Certificate " + OpenPgpFingerprint.of(cert) + " contains bad data.", e);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("IO error importing certificate " + OpenPgpFingerprint.of(cert), e);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("Thread interrupted while importing certificate " + OpenPgpFingerprint.of(cert), e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("IO-Error.", e);
|
||||
System.exit(-1);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("Thread interrupted.", e);
|
||||
System.exit(-1);
|
||||
} catch (BadDataException e) {
|
||||
LOGGER.error("Certificate contains bad data.", e);
|
||||
System.exit(-1);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@
|
|||
|
||||
package pgp.cert_d.cli.commands;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.algorithm.KeyFlag;
|
||||
import org.pgpainless.key.generation.KeyRingBuilder;
|
||||
import org.pgpainless.key.generation.KeySpec;
|
||||
import org.pgpainless.key.generation.type.KeyType;
|
||||
import org.pgpainless.key.generation.type.eddsa.EdDSACurve;
|
||||
import org.pgpainless.key.generation.type.eddsa_legacy.EdDSALegacyCurve;
|
||||
import org.pgpainless.util.Passphrase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -24,8 +23,6 @@ import picocli.CommandLine;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@CommandLine.Command(name = "setup",
|
||||
resourceBundle = "msg_setup")
|
||||
|
|
@ -86,12 +83,8 @@ public class Setup implements Runnable {
|
|||
if (passphrase != null) {
|
||||
builder.setPassphrase(passphrase);
|
||||
}
|
||||
builder.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER));
|
||||
try {
|
||||
builder.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA_LEGACY(EdDSALegacyCurve._Ed25519), KeyFlag.CERTIFY_OTHER));
|
||||
trustRoot = builder.build();
|
||||
} catch (NoSuchAlgorithmException | PGPException | InvalidAlgorithmParameterException e) {
|
||||
throw new RuntimeException("Cannot generate trust-root OpenPGP key", e);
|
||||
}
|
||||
return trustRoot;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue