2022-03-01 15:19:01 +01:00
|
|
|
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
package pgp.certificate_store;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2022-07-04 19:42:02 +02:00
|
|
|
/**
|
|
|
|
* OpenPGP certificate (public key).
|
|
|
|
*/
|
2022-03-01 15:19:01 +01:00
|
|
|
public abstract class Certificate {
|
|
|
|
/**
|
|
|
|
* Return the fingerprint of the certificate as 40 lowercase hex characters.
|
|
|
|
* TODO: Allow OpenPGP V5 fingerprints
|
|
|
|
*
|
|
|
|
* @return fingerprint
|
|
|
|
*/
|
|
|
|
public abstract String getFingerprint();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an {@link InputStream} of the binary representation of the certificate.
|
|
|
|
*
|
|
|
|
* @return input stream
|
2022-04-29 16:31:49 +02:00
|
|
|
* @throws IOException in case of an IO error
|
2022-03-01 15:19:01 +01:00
|
|
|
*/
|
|
|
|
public abstract InputStream getInputStream() throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a tag of the certificate.
|
|
|
|
* The tag is a checksum calculated over the binary representation of the certificate.
|
|
|
|
*
|
|
|
|
* @return tag
|
2022-04-29 16:31:49 +02:00
|
|
|
* @throws IOException in case of an IO error
|
2022-03-01 15:19:01 +01:00
|
|
|
*/
|
|
|
|
public abstract String getTag() throws IOException;
|
|
|
|
|
2022-04-29 16:31:49 +02:00
|
|
|
/**
|
|
|
|
* Return a {@link Set} containing key-ids of subkeys.
|
|
|
|
*
|
|
|
|
* @return subkeys
|
|
|
|
* @throws IOException in case of an IO error
|
|
|
|
*/
|
2022-03-01 15:19:01 +01:00
|
|
|
public abstract Set<Long> getSubkeyIds() throws IOException;
|
|
|
|
}
|