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

sop.operation.RevokeKey.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.InputStream
import sop.Ready
import sop.exception.SOPGPException.PasswordNotHumanReadable
import sop.exception.SOPGPException.UnsupportedOption
import sop.util.UTF8Util

interface RevokeKey {

    /**
     * Disable ASCII armor encoding.
     *
     * @return builder instance
     */
    fun noArmor(): RevokeKey

    /**
     * Provide the decryption password for the secret key.
     *
     * @param password password
     * @return builder instance
     * @throws UnsupportedOption if the implementation does not support key passwords
     * @throws PasswordNotHumanReadable if the password is not human-readable
     */
    @Throws(UnsupportedOption::class, PasswordNotHumanReadable::class)
    fun withKeyPassword(password: String): RevokeKey =
        withKeyPassword(password.toByteArray(UTF8Util.UTF8))

    /**
     * Provide the decryption password for the secret key.
     *
     * @param password password
     * @return builder instance
     * @throws UnsupportedOption if the implementation does not support key passwords
     * @throws PasswordNotHumanReadable if the password is not human-readable
     */
    @Throws(UnsupportedOption::class, PasswordNotHumanReadable::class)
    fun withKeyPassword(password: ByteArray): RevokeKey

    fun keys(bytes: ByteArray): Ready = keys(bytes.inputStream())

    fun keys(keys: InputStream): Ready
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy