mirror of
https://codeberg.org/PGPainless/cert-d-java.git
synced 2025-09-10 03:39:40 +02:00
Get rid of certificate-store abstraction
This commit is contained in:
parent
7c39781d15
commit
7cc0ef5037
30 changed files with 31 additions and 399 deletions
|
@ -0,0 +1,12 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d;
|
||||
|
||||
/**
|
||||
* The data was not a valid OpenPGP cert or key in binary format.
|
||||
*/
|
||||
public class BadDataException extends Exception {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d;
|
||||
|
||||
/**
|
||||
* Provided name was neither a valid fingerprint, nor a known special name.
|
||||
*/
|
||||
public class BadNameException extends Exception {
|
||||
|
||||
public BadNameException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BadNameException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -4,13 +4,10 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.KeyMaterial;
|
||||
import pgp.certificate_store.KeyMaterialMerger;
|
||||
import pgp.certificate_store.KeyMaterialReaderBackend;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.NotAStoreException;
|
||||
import pgp.certificate.Certificate;
|
||||
import pgp.certificate.KeyMaterial;
|
||||
import pgp.certificate.KeyMaterialMerger;
|
||||
import pgp.certificate.KeyMaterialReaderBackend;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.KeyMaterial;
|
||||
import pgp.certificate_store.KeyMaterialMerger;
|
||||
import pgp.certificate_store.KeyMaterialReaderBackend;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate.Certificate;
|
||||
import pgp.certificate.KeyMaterial;
|
||||
import pgp.certificate.KeyMaterialMerger;
|
||||
import pgp.certificate.KeyMaterialReaderBackend;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
|
@ -11,8 +11,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import pgp.certificate_store.SubkeyLookup;
|
||||
|
||||
public class InMemorySubkeyLookup implements SubkeyLookup {
|
||||
|
||||
private static final Map<Long, Set<String>> subkeyMap = new HashMap<>();
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d;
|
||||
|
||||
/**
|
||||
* The base dir cannot possibly contain a store.
|
||||
*/
|
||||
public class NotAStoreException extends Exception {
|
||||
|
||||
public NotAStoreException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NotAStoreException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.KeyMaterialReaderBackend;
|
||||
import pgp.certificate_store.exception.NotAStoreException;
|
||||
import pgp.certificate.KeyMaterialReaderBackend;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.KeyMaterial;
|
||||
import pgp.certificate_store.KeyMaterialMerger;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate.Certificate;
|
||||
import pgp.certificate.KeyMaterial;
|
||||
import pgp.certificate.KeyMaterialMerger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate.Certificate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
|
34
pgp-cert-d-java/src/main/java/pgp/cert_d/SubkeyLookup.java
Normal file
34
pgp-cert-d-java/src/main/java/pgp/cert_d/SubkeyLookup.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface SubkeyLookup {
|
||||
|
||||
/**
|
||||
* Lookup the fingerprint of the certificate that contains the given subkey.
|
||||
* If no record is found, return null.
|
||||
*
|
||||
* @param subkeyId subkey id
|
||||
* @return fingerprint of the certificate
|
||||
*
|
||||
* @throws IOException in case of an IO error
|
||||
*/
|
||||
Set<String> getCertificateFingerprintsForSubkeyId(long subkeyId) throws IOException;
|
||||
|
||||
/**
|
||||
* Record, which certificate the subkey-ids in the list belong to.
|
||||
* This method does not change the affiliation of subkey-ids not contained in the provided list.
|
||||
*
|
||||
* @param certificate certificate fingerprint
|
||||
* @param subkeyIds subkey ids
|
||||
*
|
||||
* @throws IOException in case of an IO error
|
||||
*/
|
||||
void storeCertificateSubkeyIds(String certificate, List<Long> subkeyIds) throws IOException;
|
||||
}
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.KeyMaterial;
|
||||
import pgp.certificate_store.KeyMaterialMerger;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate.Certificate;
|
||||
import pgp.certificate.KeyMaterial;
|
||||
import pgp.certificate.KeyMaterialMerger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue