All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sop.operation.DetachedSign.kt Maven / Gradle / Ivy

There is a newer version: 10.0.3
Show newest version
// SPDX-FileCopyrightText: 2023 Paul Schaub 
//
// SPDX-License-Identifier: Apache-2.0

package sop.operation

import java.io.IOException
import java.io.InputStream
import sop.ReadyWithResult
import sop.SigningResult
import sop.enums.SignAs
import sop.exception.SOPGPException.*

interface DetachedSign : AbstractSign {

    /**
     * Sets the signature mode. Note: This method has to be called before [key] is called.
     *
     * @param mode signature mode
     * @return builder instance
     * @throws UnsupportedOption if this option is not supported
     */
    @Throws(UnsupportedOption::class) fun mode(mode: SignAs): DetachedSign

    /**
     * Signs data.
     *
     * @param data input stream containing data
     * @return ready
     * @throws IOException in case of an IO error
     * @throws KeyIsProtected if at least one signing key cannot be unlocked
     * @throws ExpectedText if text data was expected, but binary data was encountered
     */
    @Throws(IOException::class, KeyIsProtected::class, ExpectedText::class)
    fun data(data: InputStream): ReadyWithResult

    /**
     * Signs data.
     *
     * @param data byte array containing data
     * @return ready
     * @throws IOException in case of an IO error
     * @throws sop.exception.SOPGPException.KeyIsProtected if at least one signing key cannot be
     *   unlocked
     * @throws sop.exception.SOPGPException.ExpectedText if text data was expected, but binary data
     *   was encountered
     */
    @Throws(IOException::class, KeyIsProtected::class, ExpectedText::class)
    fun data(data: ByteArray): ReadyWithResult = data(data.inputStream())
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy