Compare commits

..

No commits in common. "9d20355a589b8ed92bc3fc174c28471cd8e3192d" and "190194f932c5e7d44ecd5f8df0366aefbee34a03" have entirely different histories.

6 changed files with 13 additions and 23 deletions

View file

@ -5,9 +5,6 @@ SPDX-License-Identifier: CC0-1.0
# Cert-D-Java Changelog # Cert-D-Java Changelog
## 0.2.2
- Bump Bouncy Castle to `1.75`
## 0.2.1 ## 0.2.1
- Throw `NoSuchElementException` when querying non-existent certificates - Throw `NoSuchElementException` when querying non-existent certificates

View file

@ -32,7 +32,7 @@ dependencies {
testImplementation project(":pgp-cert-d-java-jdbc-sqlite-lookup") testImplementation project(":pgp-cert-d-java-jdbc-sqlite-lookup")
testImplementation "org.bouncycastle:bcprov-jdk15to18:$bouncycastleVersion" testImplementation "org.bouncycastle:bcprov-jdk15to18:$bouncycastleVersion"
testImplementation "org.bouncycastle:bcpg-jdk15to18:$bouncyPgVersion" testImplementation "org.bouncycastle:bcpg-jdk15to18:$bouncycastleVersion"
} }
animalsniffer { animalsniffer {

View file

@ -10,7 +10,6 @@ import pgp.certificate_store.exception.BadNameException;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException;
/** /**
* Interface for a read-only OpenPGP certificate directory. * Interface for a read-only OpenPGP certificate directory.
@ -20,12 +19,12 @@ public interface ReadOnlyPGPCertificateDirectory {
/** /**
* Get the trust-root certificate. This is a certificate which is stored under the special name * Get the trust-root certificate. This is a certificate which is stored under the special name
* <pre>trust-root</pre>. * <pre>trust-root</pre>.
* If no such certificate is found, <pre>null</pre> is returned.
* *
* @return trust-root certificate * @return trust-root certificate
* *
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getTrustRootCertificate() Certificate getTrustRootCertificate()
throws IOException, BadDataException; throws IOException, BadDataException;
@ -37,25 +36,24 @@ public interface ReadOnlyPGPCertificateDirectory {
* Otherwise. the changed certificate is returned. * Otherwise. the changed certificate is returned.
* *
* @param tag tag * @param tag tag
* @return changed certificate, or null if the certificate is unchanged. * @return changed certificate, or null if the certificate is unchanged or not found.
* *
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getTrustRootCertificateIfChanged(long tag) Certificate getTrustRootCertificateIfChanged(long tag)
throws IOException, BadDataException; throws IOException, BadDataException;
/** /**
* Get the certificate identified by the given fingerprint. * Get the certificate identified by the given fingerprint.
* If no such certificate is found, return <pre>null</pre>.
* *
* @param fingerprint lower-case fingerprint of the certificate * @param fingerprint lower-case fingerprint of the certificate
* @return certificate * @return certificate or null if no such certificate has been found
* *
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadNameException if the fingerprint is malformed * @throws BadNameException if the fingerprint is malformed
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getByFingerprint(String fingerprint) Certificate getByFingerprint(String fingerprint)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;
@ -68,26 +66,25 @@ public interface ReadOnlyPGPCertificateDirectory {
* *
* @param fingerprint lower-case fingerprint of the certificate * @param fingerprint lower-case fingerprint of the certificate
* @param tag tag * @param tag tag
* @return certificate or null if the certificate has not been changed * @return certificate or null if the certificate has not been changed or has not been found
* *
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadNameException if the fingerprint is malformed * @throws BadNameException if the fingerprint is malformed
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getByFingerprintIfChanged(String fingerprint, long tag) Certificate getByFingerprintIfChanged(String fingerprint, long tag)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;
/** /**
* Get the certificate identified by the given special name. * Get the certificate identified by the given special name.
* If no such certificate is found, <pre>null</pre> is returned.
* *
* @param specialName special name * @param specialName special name
* @return certificate * @return certificate or null
* *
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadNameException if the special name is not known * @throws BadNameException if the special name is not known
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getBySpecialName(String specialName) Certificate getBySpecialName(String specialName)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;
@ -105,7 +102,6 @@ public interface ReadOnlyPGPCertificateDirectory {
* @throws IOException in case of an IO error * @throws IOException in case of an IO error
* @throws BadNameException if the special name is not known * @throws BadNameException if the special name is not known
* @throws BadDataException if the certificate contains bad data * @throws BadDataException if the certificate contains bad data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getBySpecialNameIfChanged(String specialName, long tag) Certificate getBySpecialNameIfChanged(String specialName, long tag)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;

View file

@ -18,7 +18,7 @@ public class BaseDirectoryProviderTest {
public void testGetDefaultBaseDir_Linux() { public void testGetDefaultBaseDir_Linux() {
assumeTrue(System.getProperty("os.name").equalsIgnoreCase("linux")); assumeTrue(System.getProperty("os.name").equalsIgnoreCase("linux"));
File baseDir = BaseDirectoryProvider.getDefaultBaseDirForOS("linux"); File baseDir = BaseDirectoryProvider.getDefaultBaseDirForOS("linux");
assertTrue(baseDir.getAbsolutePath().endsWith("pgp.cert.d")); assertTrue(baseDir.getAbsolutePath().endsWith("/.local/share/pgp.cert.d"));
} }
@Test @Test

View file

@ -12,7 +12,6 @@ import pgp.certificate_store.exception.BadNameException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException;
/** /**
* Interface for an OpenPGP certificate (public key) store. * Interface for an OpenPGP certificate (public key) store.
@ -21,6 +20,7 @@ public interface PGPCertificateStore {
/** /**
* Return the certificate that matches the given identifier. * Return the certificate that matches the given identifier.
* If no matching certificate can be found, return null.
* *
* @param identifier identifier for a certificate. * @param identifier identifier for a certificate.
* @return certificate or null * @return certificate or null
@ -28,7 +28,6 @@ public interface PGPCertificateStore {
* @throws IOException in case of an IO-error * @throws IOException in case of an IO-error
* @throws BadNameException if the identifier is invalid * @throws BadNameException if the identifier is invalid
* @throws BadDataException if the certificate file contains invalid data * @throws BadDataException if the certificate file contains invalid data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getCertificate(String identifier) Certificate getCertificate(String identifier)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;
@ -46,7 +45,6 @@ public interface PGPCertificateStore {
* @throws IOException in case of an IO-error * @throws IOException in case of an IO-error
* @throws BadNameException if the identifier is invalid * @throws BadNameException if the identifier is invalid
* @throws BadDataException if the certificate file contains invalid data * @throws BadDataException if the certificate file contains invalid data
* @throws NoSuchElementException if no such certificate is found
*/ */
Certificate getCertificateIfChanged(String identifier, Long tag) Certificate getCertificateIfChanged(String identifier, Long tag)
throws IOException, BadNameException, BadDataException; throws IOException, BadNameException, BadDataException;

View file

@ -4,16 +4,15 @@
allprojects { allprojects {
ext { ext {
shortVersion = '0.2.3' shortVersion = '0.2.2'
isSnapshot = true isSnapshot = true
minAndroidSdk = 26 minAndroidSdk = 26
animalsnifferSignatureVersion = "$minAndroidSdk:8.0.0_r2" animalsnifferSignatureVersion = "$minAndroidSdk:8.0.0_r2"
javaSourceCompatibility = 1.8 javaSourceCompatibility = 1.8
bouncycastleVersion = '1.75' bouncycastleVersion = '1.71'
bouncyPgVersion = "$bouncycastleVersion"
slf4jVersion = '1.7.36' slf4jVersion = '1.7.36'
logbackVersion = '1.2.11' logbackVersion = '1.2.11'
junitVersion = '5.8.2' junitVersion = '5.8.2'
sqliteJdbcVersion = '3.42.0.0' sqliteJdbcVersion = '3.36.0.3'
} }
} }