Compare commits

...

4 Commits

7 changed files with 29 additions and 6 deletions

View File

@ -5,9 +5,19 @@ SPDX-License-Identifier: CC0-1.0
# Cert-D-PGPainless Changelog # Cert-D-PGPainless Changelog
## 0.1.3-SNAPSHOT ## 0.2.0
- `get`: Apply `toLowerCase()` to fingerprints - `get`: Apply `toLowerCase()` to fingerprints
- Use BCs `PGPPublicKeyRing.join(first, second)` method to properly merge certificates - Use BCs `PGPPublicKeyRing.join(first, second)` method to properly merge certificates
- Implement storing of `trust-root` key
- Bump `cert-d-java` to `0.2.1`
- Changes to CLI
- Add support for i18n using resource bundles
- Rename `import` command to `insert`
- Rename `multi-import` command to `import`
- Add `export` command
- Add basic `list` command
- `get` command: Allow querying by special name
- Add armor headers to output of `get` command
## 0.1.2 ## 0.1.2
- Add name and description to main command - Add name and description to main command

View File

@ -9,7 +9,8 @@ SPDX-License-Identifier: Apache-2.0
[![Coverage Status](https://coveralls.io/repos/github/pgpainless/cert-d-pgpainless/badge.svg?branch=main)](https://coveralls.io/github/pgpainless/cert-d-pgpainless?branch=main) [![Coverage Status](https://coveralls.io/repos/github/pgpainless/cert-d-pgpainless/badge.svg?branch=main)](https://coveralls.io/github/pgpainless/cert-d-pgpainless?branch=main)
[![REUSE status](https://api.reuse.software/badge/github.com/pgpainless/cert-d-pgpainless)](https://api.reuse.software/info/github.com/pgpainless/cert-d-pgpainless) [![REUSE status](https://api.reuse.software/badge/github.com/pgpainless/cert-d-pgpainless)](https://api.reuse.software/info/github.com/pgpainless/cert-d-pgpainless)
This repository contains implementations of the [Shared PGP Certificate Directory](https://sequoia-pgp.gitlab.io/pgp-cert-d/) specification using [PGPainless](https://pgpainless.org) as backend. This repository contains implementations of the [Shared PGP Certificate Directory](https://sequoia-pgp.gitlab.io/pgp-cert-d/)
specification using [PGPainless](https://pgpainless.org) as backend.
The module `pgpainless-cert-d` can be used as a drop-in implementation of The module `pgpainless-cert-d` can be used as a drop-in implementation of
`pgp-certificate-store`. `pgp-certificate-store`.

View File

@ -33,6 +33,9 @@ public class Import implements Runnable {
ByteArrayInputStream certIn = new ByteArrayInputStream(cert.getEncoded()); ByteArrayInputStream certIn = new ByteArrayInputStream(cert.getEncoded());
Certificate certificate = PGPCertDCli.getCertificateDirectory() Certificate certificate = PGPCertDCli.getCertificateDirectory()
.insert(certIn, MergeCallbacks.mergeWithExisting()); .insert(certIn, MergeCallbacks.mergeWithExisting());
// CHECKSTYLE:OFF
System.out.println(certificate.getFingerprint());
// CHECKSTYLE:ON
} }
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("IO-Error.", e); LOGGER.error("IO-Error.", e);

View File

@ -25,6 +25,9 @@ public class Insert implements Runnable {
try { try {
Certificate certificate = PGPCertDCli.getCertificateDirectory() Certificate certificate = PGPCertDCli.getCertificateDirectory()
.insert(System.in, MergeCallbacks.mergeWithExisting()); .insert(System.in, MergeCallbacks.mergeWithExisting());
// CHECKSTYLE:OFF
System.out.println(certificate.getFingerprint());
// CHECKSTYLE:ON
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("IO-Error.", e); LOGGER.error("IO-Error.", e);
System.exit(-1); System.exit(-1);

View File

@ -17,6 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.pgpainless.certificate_store.MergeCallbacks; import org.pgpainless.certificate_store.MergeCallbacks;
import pgp.cert_d.cli.PGPCertDCli; import pgp.cert_d.cli.PGPCertDCli;
import pgp.certificate_store.certificate.KeyMaterial;
import pgp.certificate_store.exception.BadDataException; import pgp.certificate_store.exception.BadDataException;
import picocli.CommandLine; import picocli.CommandLine;
@ -61,7 +62,11 @@ public class Setup implements Runnable {
try { try {
InputStream inputStream = new ByteArrayInputStream(trustRoot.getEncoded()); InputStream inputStream = new ByteArrayInputStream(trustRoot.getEncoded());
PGPCertDCli.getCertificateDirectory().insertTrustRoot(inputStream, MergeCallbacks.overrideExisting()); KeyMaterial inserted = PGPCertDCli.getCertificateDirectory()
.insertTrustRoot(inputStream, MergeCallbacks.overrideExisting());
// CHECKSTYLE:OFF
System.out.println(inserted.getFingerprint());
// CHECKSTYLE:ON
} catch (BadDataException e) { } catch (BadDataException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -16,6 +16,7 @@ import pgp.certificate_store.certificate.KeyMaterialMerger;
import pgp.certificate_store.exception.BadDataException; import pgp.certificate_store.exception.BadDataException;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
public class MergeCallbacks { public class MergeCallbacks {
@ -107,7 +108,7 @@ public class MergeCallbacks {
} }
} }
private void printOutDifferences(PGPKeyRing existingCert, PGPKeyRing mergedCert) { private void printOutDifferences(PGPKeyRing existingCert, PGPKeyRing mergedCert) throws IOException {
int numSigsBefore = countSigs(existingCert); int numSigsBefore = countSigs(existingCert);
int numSigsAfter = countSigs(mergedCert); int numSigsAfter = countSigs(mergedCert);
int newSigs = numSigsAfter - numSigsBefore; int newSigs = numSigsAfter - numSigsBefore;
@ -115,7 +116,7 @@ public class MergeCallbacks {
int numUidsAfter = count(mergedCert.getPublicKey().getUserIDs()); int numUidsAfter = count(mergedCert.getPublicKey().getUserIDs());
int newUids = numUidsAfter - numUidsBefore; int newUids = numUidsAfter - numUidsBefore;
if (!existingCert.equals(mergedCert)) { if (!Arrays.equals(existingCert.getEncoded(), mergedCert.getEncoded())) {
OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(mergedCert); OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(mergedCert);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(String.format("Certificate %s has", fingerprint)); sb.append(String.format("Certificate %s has", fingerprint));

View File

@ -4,7 +4,7 @@
allprojects { allprojects {
ext { ext {
shortVersion = '0.1.3' shortVersion = '0.2.1'
isSnapshot = true isSnapshot = true
minAndroidSdk = 10 minAndroidSdk = 10
javaSourceCompatibility = 1.8 javaSourceCompatibility = 1.8