mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-16 17:21:08 +01:00
Add tests for SharedPGPCertificateDirectoryAdapter
This commit is contained in:
parent
0ef4f3b781
commit
04be9d9dcc
9 changed files with 286 additions and 2 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.SubkeyLookup;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class SpecialNames {
|
|||
private static final Map<String, String> SPECIAL_NAMES = new HashMap<>();
|
||||
|
||||
static {
|
||||
SPECIAL_NAMES.put("TRUST-ROOT", "trust-root");
|
||||
SPECIAL_NAMES.put("TRUST-ROOT", "trust-root"); // TODO: Remove
|
||||
SPECIAL_NAMES.put("trust-root", "trust-root");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pgp.cert_d;
|
||||
|
||||
public interface SubkeyLookup {
|
||||
|
||||
/**
|
||||
* Lookup the identifier of the certificate that contains the given subkey.
|
||||
* If no record is found, return null.
|
||||
*
|
||||
* @param subkeyId subkey id
|
||||
* @return identifier (fingerprint or special name) of the certificate
|
||||
*/
|
||||
String getIdentifierForSubkeyId(long subkeyId);
|
||||
|
||||
/**
|
||||
* Store a record of the subkey id that points to the identifier.
|
||||
*
|
||||
* @param subkeyId subkey id
|
||||
* @param identifier fingerprint or special name of the certificate
|
||||
*/
|
||||
void storeIdentifierForSubkeyId(long subkeyId, String identifier);
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package pgp.cert_d;
|
||||
|
||||
import pgp.certificate_store.SubkeyLookup;
|
||||
|
||||
public class SubkeyLookupImpl implements SubkeyLookup {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import org.junit.jupiter.api.AfterAll;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import pgp.certificate_store.SubkeyLookup;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue