mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Add OpenPGPSecretKey.unlock(Passphrase) extension method
This commit is contained in:
parent
e2d8db6796
commit
a8a09b7db7
1 changed files with 5 additions and 0 deletions
|
@ -7,10 +7,15 @@ package org.pgpainless.bouncycastle.extensions
|
|||
import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData
|
||||
import org.bouncycastle.openpgp.PGPSignature
|
||||
import org.bouncycastle.openpgp.api.OpenPGPKey
|
||||
import org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPPrivateKey
|
||||
import org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPSecretKey
|
||||
import org.pgpainless.util.Passphrase
|
||||
|
||||
fun OpenPGPKey.getSecretKeyFor(pkesk: PGPPublicKeyEncryptedData): OpenPGPSecretKey? =
|
||||
this.getSecretKey(pkesk.keyIdentifier)
|
||||
|
||||
fun OpenPGPKey.getSecretKeyFor(signature: PGPSignature): OpenPGPSecretKey? =
|
||||
this.getSecretKey(signature.fingerprint!!.keyIdentifier)
|
||||
|
||||
fun OpenPGPKey.OpenPGPSecretKey.unlock(passphrase: Passphrase): OpenPGPPrivateKey =
|
||||
this.unlock(passphrase.getChars())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue