cert-d-java/pgp-certificate-store/src/main/java/pgp/certificate_store/SubkeyLookup.java

38 lines
1.2 KiB
Java

// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package pgp.certificate_store;
import java.io.IOException;
import java.util.List;
import java.util.Set;
/**
* The {@link SubkeyLookup} class defines an interface for recording and looking up, to which certificates
* a certain subkey belongs to.
*
* For a basic implementation it is enough to implement CR (out of CRUD) operations.
*/
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
*/
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;
}