mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-10 18:59:43 +02:00
Add implementation of update-key command
This commit is contained in:
parent
a07446e29a
commit
a2315f9847
6 changed files with 163 additions and 12 deletions
|
@ -4,18 +4,7 @@
|
|||
|
||||
package sop
|
||||
|
||||
import sop.operation.Armor
|
||||
import sop.operation.ChangeKeyPassword
|
||||
import sop.operation.Dearmor
|
||||
import sop.operation.Decrypt
|
||||
import sop.operation.DetachedSign
|
||||
import sop.operation.Encrypt
|
||||
import sop.operation.ExtractCert
|
||||
import sop.operation.GenerateKey
|
||||
import sop.operation.InlineDetach
|
||||
import sop.operation.InlineSign
|
||||
import sop.operation.ListProfiles
|
||||
import sop.operation.RevokeKey
|
||||
import sop.operation.*
|
||||
|
||||
/**
|
||||
* Stateless OpenPGP Interface. This class provides a stateless interface to various OpenPGP related
|
||||
|
@ -70,4 +59,9 @@ interface SOP : SOPV {
|
|||
|
||||
/** Update a key's password. */
|
||||
fun changeKeyPassword(): ChangeKeyPassword
|
||||
|
||||
/**
|
||||
* Keep a secret key up-to-date.
|
||||
*/
|
||||
fun updateKey(): UpdateKey
|
||||
}
|
||||
|
|
43
sop-java/src/main/kotlin/sop/operation/UpdateKey.kt
Normal file
43
sop-java/src/main/kotlin/sop/operation/UpdateKey.kt
Normal file
|
@ -0,0 +1,43 @@
|
|||
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package sop.operation
|
||||
|
||||
import sop.Ready
|
||||
import sop.exception.SOPGPException
|
||||
import sop.util.UTF8Util
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
interface UpdateKey {
|
||||
|
||||
/**
|
||||
* Disable ASCII armor encoding of the output.
|
||||
*
|
||||
* @return builder instance
|
||||
*/
|
||||
fun noArmor(): UpdateKey
|
||||
|
||||
@Throws(SOPGPException.UnsupportedOption::class) fun signingOnly(): UpdateKey
|
||||
|
||||
@Throws(SOPGPException.UnsupportedOption::class) fun noNewMechanisms(): UpdateKey
|
||||
|
||||
@Throws(SOPGPException.PasswordNotHumanReadable::class, SOPGPException.UnsupportedOption::class)
|
||||
fun withKeyPassword(password: String): UpdateKey = withKeyPassword(password.toByteArray(UTF8Util.UTF8))
|
||||
|
||||
@Throws(SOPGPException.PasswordNotHumanReadable::class, SOPGPException.UnsupportedOption::class)
|
||||
fun withKeyPassword(password: ByteArray): UpdateKey
|
||||
|
||||
@Throws(SOPGPException.UnsupportedOption::class, SOPGPException.BadData::class, IOException::class)
|
||||
fun mergeCerts(certs: InputStream): UpdateKey
|
||||
|
||||
@Throws(SOPGPException.UnsupportedOption::class, SOPGPException.BadData::class, IOException::class)
|
||||
fun mergeCerts(certs: ByteArray): UpdateKey = mergeCerts(certs.inputStream())
|
||||
|
||||
@Throws(SOPGPException.BadData::class, IOException::class, SOPGPException.KeyIsProtected::class, SOPGPException.PrimaryKeyBad::class)
|
||||
fun key(key: InputStream): Ready
|
||||
|
||||
@Throws(SOPGPException.BadData::class, IOException::class, SOPGPException.KeyIsProtected::class, SOPGPException.PrimaryKeyBad::class)
|
||||
fun key(key: ByteArray): Ready = key(key.inputStream())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue