mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-01-09 19:57:57 +01:00
Add handy shortcut methods to the API
This commit is contained in:
parent
f10d698a09
commit
7de04c2949
1 changed files with 34 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
package org.pgpainless.decryption_verification;
|
package org.pgpainless.decryption_verification;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -72,6 +73,39 @@ public interface DecryptionBuilderInterface {
|
||||||
|
|
||||||
interface Verify extends VerifyWith {
|
interface Verify extends VerifyWith {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
HandleMissingPublicKeys verifyWith(@Nonnull PGPPublicKeyRingCollection publicKeyRings);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default HandleMissingPublicKeys verifyWith(@Nonnull OpenPgpV4Fingerprint trustedFingerprint,
|
||||||
|
@Nonnull PGPPublicKeyRingCollection publicKeyRings) {
|
||||||
|
return verifyWith(Collections.singleton(trustedFingerprint), publicKeyRings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
HandleMissingPublicKeys verifyWith(@Nonnull Set<OpenPgpV4Fingerprint> trustedFingerprints,
|
||||||
|
@Nonnull PGPPublicKeyRingCollection publicKeyRings);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default HandleMissingPublicKeys verifyWith(@Nonnull PGPPublicKeyRing publicKeyRing) {
|
||||||
|
return verifyWith(Collections.singleton(publicKeyRing));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
HandleMissingPublicKeys verifyWith(@Nonnull Set<PGPPublicKeyRing> publicKeyRings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pass in one or more detached signatures to verify.
|
||||||
|
*
|
||||||
|
* @param bytes detached signatures (ascii armored or binary).
|
||||||
|
* @return api handle
|
||||||
|
* @throws IOException if some IO error occurs
|
||||||
|
* @throws PGPException if the detached signatures are malformed
|
||||||
|
*/
|
||||||
|
default VerifyWith verifyDetachedSignature(@Nonnull byte[] bytes) throws IOException, PGPException {
|
||||||
|
return verifyDetachedSignature(new ByteArrayInputStream(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass in one or more detached signatures to verify.
|
* Pass in one or more detached signatures to verify.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue