mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-16 17:21:08 +01:00
Move Shared PGP Certificate Directory Exceptions to pgp certificate store
This commit is contained in:
parent
0c5cad677c
commit
983f39c56f
17 changed files with 88 additions and 197 deletions
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.cert_d.exception.BadDataException;
|
||||
import pgp.cert_d.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
|
||||
@Override
|
||||
public Certificate getBySpecialName(String specialName)
|
||||
throws IOException, BadNameException {
|
||||
throws IOException, BadNameException, BadDataException {
|
||||
Certificate certificate = certificateMap.get(specialName);
|
||||
if (certificate == null) {
|
||||
certificate = underlyingCertificateDirectory.getBySpecialName(specialName);
|
||||
|
|
@ -119,7 +119,7 @@ public class CachingSharedPGPCertificateDirectoryWrapper
|
|||
|
||||
@Override
|
||||
public Certificate getBySpecialNameIfChanged(String specialName, String tag)
|
||||
throws IOException, BadNameException {
|
||||
throws IOException, BadNameException, BadDataException {
|
||||
if (tagChanged(specialName, tag)) {
|
||||
return getBySpecialName(specialName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.cert_d.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
|
||||
import pgp.cert_d.exception.BadDataException;
|
||||
import pgp.cert_d.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
|
||||
|
|
@ -21,13 +21,13 @@ public interface SharedPGPCertificateDirectory {
|
|||
throws IOException, BadNameException, BadDataException;
|
||||
|
||||
Certificate getBySpecialName(String specialName)
|
||||
throws IOException, BadNameException;
|
||||
throws IOException, BadNameException, BadDataException;
|
||||
|
||||
Certificate getByFingerprintIfChanged(String fingerprint, String tag)
|
||||
throws IOException, BadNameException, BadDataException;
|
||||
|
||||
Certificate getBySpecialNameIfChanged(String specialName, String tag)
|
||||
throws IOException, BadNameException;
|
||||
throws IOException, BadNameException, BadDataException;
|
||||
|
||||
Certificate insert(InputStream data, MergeCallback merge)
|
||||
throws IOException, BadDataException, InterruptedException;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import pgp.cert_d.exception.BadDataException;
|
||||
import pgp.cert_d.exception.BadNameException;
|
||||
import pgp.cert_d.exception.NotAStoreException;
|
||||
import pgp.certificate_store.exception.BadDataException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.NotAStoreException;
|
||||
import pgp.certificate_store.Certificate;
|
||||
import pgp.certificate_store.CertificateReaderBackend;
|
||||
import pgp.certificate_store.MergeCallback;
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d.exception;
|
||||
|
||||
/**
|
||||
* The data was not a valid OpenPGP cert or key in binary format.
|
||||
*/
|
||||
public class BadDataException extends Exception {
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d.exception;
|
||||
|
||||
/**
|
||||
* Provided name was neither a valid fingerprint, nor a known special name.
|
||||
*/
|
||||
public class BadNameException extends Exception {
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d.exception;
|
||||
|
||||
/**
|
||||
* The base dir cannot possibly contain a store.
|
||||
*/
|
||||
public class NotAStoreException extends Exception {
|
||||
|
||||
public NotAStoreException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NotAStoreException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/**
|
||||
* Exceptions defined by the Shared PGP Certificate Directory.
|
||||
*
|
||||
* @see <a href="https://sequoia-pgp.gitlab.io/pgp-cert-d/#name-failure-modes">Failure Modes</a>
|
||||
*/
|
||||
package pgp.cert_d.exception;
|
||||
|
|
@ -6,7 +6,7 @@ package pgp.cert_d;
|
|||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import pgp.cert_d.exception.BadNameException;
|
||||
import pgp.certificate_store.exception.BadNameException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue