1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-08 21:31:08 +01:00

Port test

This commit is contained in:
Paul Schaub 2025-02-17 12:25:28 +01:00
parent cdc51c0037
commit 5161a46594
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
5 changed files with 29 additions and 29 deletions

View file

@ -430,7 +430,7 @@ class OpenPgpMessageInputStream(
}
if (decryptWithPrivateKey(
esks,
privateKey.unlockedKey,
privateKey.keyPair,
SubkeyIdentifier(
secretKey.openPGPKey.pgpSecretKeyRing, secretKey.keyIdentifier),
pkesk)) {
@ -458,7 +458,7 @@ class OpenPgpMessageInputStream(
val privateKey = decryptionKey.unlock(protector)
if (decryptWithPrivateKey(
esks, privateKey.unlockedKey, SubkeyIdentifier(decryptionKey), pkesk)) {
esks, privateKey.keyPair, SubkeyIdentifier(decryptionKey), pkesk)) {
return true
}
}
@ -489,7 +489,7 @@ class OpenPgpMessageInputStream(
} catch (e: PGPException) {
throw WrongPassphraseException(secretKey.keyIdentifier, e)
}
if (decryptWithPrivateKey(esks, privateKey.unlockedKey, decryptionKeyId, pkesk)) {
if (decryptWithPrivateKey(esks, privateKey.keyPair, decryptionKeyId, pkesk)) {
return true
}
}

View file

@ -25,6 +25,7 @@ import org.pgpainless.util.Passphrase
class EncryptionOptions(private val purpose: EncryptionPurpose) {
private val _encryptionMethods: MutableSet<PGPKeyEncryptionMethodGenerator> = mutableSetOf()
private val _encryptionKeys: MutableSet<OpenPGPComponentKey> = mutableSetOf()
private val _encryptionKeyIdentifiers: MutableSet<SubkeyIdentifier> = mutableSetOf()
private val _keyRingInfo: MutableMap<SubkeyIdentifier, KeyRingInfo> = mutableMapOf()
private val _keyViews: MutableMap<SubkeyIdentifier, KeyAccessor> = mutableMapOf()
@ -40,6 +41,9 @@ class EncryptionOptions(private val purpose: EncryptionPurpose) {
val encryptionKeyIdentifiers
get() = _encryptionKeyIdentifiers.toSet()
val encryptionKeys
get() = _encryptionKeys.toSet()
val keyRingInfo
get() = _keyRingInfo.toMap()
@ -326,6 +330,7 @@ class EncryptionOptions(private val purpose: EncryptionPurpose) {
}
private fun addRecipientKey(key: OpenPGPComponentKey, wildcardKeyId: Boolean) {
_encryptionKeys.add(key)
_encryptionKeyIdentifiers.add(SubkeyIdentifier(key))
addEncryptionMethod(
ImplementationFactory.getInstance()

View file

@ -450,8 +450,7 @@ class SigningOptions {
}
val generator: PGPSignatureGenerator =
createSignatureGenerator(
signingKey.unlockedKey.privateKey, hashAlgorithm, signatureType)
createSignatureGenerator(signingKey.keyPair.privateKey, hashAlgorithm, signatureType)
// Subpackets
val hashedSubpackets =

View file

@ -61,7 +61,7 @@ class UnlockSecretKey {
if (PGPainless.getPolicy().isEnableKeyParameterValidation()) {
PublicKeyParameterValidationUtil.verifyPublicKeyParameterIntegrity(
privateKey.unlockedKey.privateKey, privateKey.unlockedKey.publicKey)
privateKey.keyPair.privateKey, privateKey.keyPair.publicKey)
}
return privateKey