mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-22 23:22:05 +01:00
Kotlin conversion DetachedVerify
This commit is contained in:
parent
ee6975c7d3
commit
e681090757
2 changed files with 36 additions and 45 deletions
|
@ -1,45 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
package sop.operation;
|
|
||||||
|
|
||||||
import sop.exception.SOPGPException;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* API for verifying detached signatures.
|
|
||||||
*/
|
|
||||||
public interface DetachedVerify extends AbstractVerify<DetachedVerify>, VerifySignatures {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides the detached signatures.
|
|
||||||
* @param signatures input stream containing encoded, detached signatures.
|
|
||||||
*
|
|
||||||
* @return builder instance
|
|
||||||
*
|
|
||||||
* @throws sop.exception.SOPGPException.BadData if the input stream does not contain OpenPGP signatures
|
|
||||||
* @throws IOException in case of an IO error
|
|
||||||
*/
|
|
||||||
VerifySignatures signatures(InputStream signatures)
|
|
||||||
throws SOPGPException.BadData,
|
|
||||||
IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides the detached signatures.
|
|
||||||
* @param signatures byte array containing encoded, detached signatures.
|
|
||||||
*
|
|
||||||
* @return builder instance
|
|
||||||
*
|
|
||||||
* @throws sop.exception.SOPGPException.BadData if the byte array does not contain OpenPGP signatures
|
|
||||||
* @throws IOException in case of an IO error
|
|
||||||
*/
|
|
||||||
default VerifySignatures signatures(byte[] signatures)
|
|
||||||
throws SOPGPException.BadData,
|
|
||||||
IOException {
|
|
||||||
return signatures(new ByteArrayInputStream(signatures));
|
|
||||||
}
|
|
||||||
}
|
|
36
sop-java/src/main/kotlin/sop/operation/DetachedVerify.kt
Normal file
36
sop-java/src/main/kotlin/sop/operation/DetachedVerify.kt
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package sop.operation
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
|
import sop.exception.SOPGPException.BadData
|
||||||
|
|
||||||
|
interface DetachedVerify : AbstractVerify<DetachedVerify>, VerifySignatures {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the detached signatures.
|
||||||
|
*
|
||||||
|
* @param signatures input stream containing encoded, detached signatures.
|
||||||
|
* @return builder instance
|
||||||
|
* @throws BadData if the input stream does not contain OpenPGP signatures
|
||||||
|
* @throws IOException in case of an IO error
|
||||||
|
*/
|
||||||
|
@Throws(BadData::class, IOException::class)
|
||||||
|
fun signatures(signatures: InputStream): VerifySignatures
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the detached signatures.
|
||||||
|
*
|
||||||
|
* @param signatures byte array containing encoded, detached signatures.
|
||||||
|
* @return builder instance
|
||||||
|
* @throws BadData if the byte array does not contain OpenPGP signatures
|
||||||
|
* @throws IOException in case of an IO error
|
||||||
|
*/
|
||||||
|
@Throws(BadData::class, IOException::class)
|
||||||
|
fun signatures(signatures: ByteArray): VerifySignatures =
|
||||||
|
signatures(ByteArrayInputStream(signatures))
|
||||||
|
}
|
Loading…
Reference in a new issue