mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Even more migration and code compiles again
This commit is contained in:
parent
c039ab543a
commit
070879ee02
50 changed files with 368 additions and 245 deletions
|
@ -4,9 +4,11 @@
|
|||
|
||||
package org.pgpainless.sop
|
||||
|
||||
import org.bouncycastle.bcpg.KeyIdentifier
|
||||
import org.bouncycastle.openpgp.PGPException
|
||||
import org.bouncycastle.openpgp.PGPSecretKey
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing
|
||||
import org.bouncycastle.openpgp.api.OpenPGPKey
|
||||
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor
|
||||
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor
|
||||
import org.pgpainless.bouncycastle.extensions.isDecrypted
|
||||
|
@ -41,7 +43,7 @@ class MatchMakingSecretKeyRingProtector : SecretKeyRingProtector {
|
|||
}
|
||||
|
||||
if (testPassphrase(passphrase, subkey)) {
|
||||
protector.addPassphrase(subkey.keyID, passphrase)
|
||||
protector.addPassphrase(subkey.keyIdentifier, passphrase)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +56,11 @@ class MatchMakingSecretKeyRingProtector : SecretKeyRingProtector {
|
|||
|
||||
key.forEach { subkey ->
|
||||
if (subkey.isDecrypted()) {
|
||||
protector.addPassphrase(subkey.keyID, Passphrase.emptyPassphrase())
|
||||
protector.addPassphrase(subkey.keyIdentifier, Passphrase.emptyPassphrase())
|
||||
} else {
|
||||
passphrases.forEach { passphrase ->
|
||||
if (testPassphrase(passphrase, subkey)) {
|
||||
protector.addPassphrase(subkey.keyID, passphrase)
|
||||
protector.addPassphrase(subkey.keyIdentifier, passphrase)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,11 +76,17 @@ class MatchMakingSecretKeyRingProtector : SecretKeyRingProtector {
|
|||
false
|
||||
}
|
||||
|
||||
override fun hasPassphraseFor(keyId: Long): Boolean = protector.hasPassphrase(keyId)
|
||||
override fun hasPassphraseFor(keyIdentifier: KeyIdentifier): Boolean =
|
||||
protector.hasPassphrase(keyIdentifier)
|
||||
|
||||
override fun getDecryptor(keyId: Long): PBESecretKeyDecryptor? = protector.getDecryptor(keyId)
|
||||
override fun getDecryptor(keyIdentifier: KeyIdentifier): PBESecretKeyDecryptor? =
|
||||
protector.getDecryptor(keyIdentifier)
|
||||
|
||||
override fun getEncryptor(keyId: Long): PBESecretKeyEncryptor? = protector.getEncryptor(keyId)
|
||||
override fun getEncryptor(keyIdentifier: KeyIdentifier): PBESecretKeyEncryptor? =
|
||||
protector.getEncryptor(keyIdentifier)
|
||||
|
||||
override fun getKeyPassword(p0: OpenPGPKey.OpenPGPSecretKey): CharArray? =
|
||||
protector.getKeyPassword(p0)
|
||||
|
||||
/** Clear all known passphrases from the protector. */
|
||||
fun clear() {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package sop.testsuite.pgpainless.operation;
|
||||
|
||||
import org.bouncycastle.bcpg.KeyIdentifier;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
|
@ -38,9 +39,9 @@ public class PGPainlessChangeKeyPasswordTest extends ChangeKeyPasswordTest {
|
|||
.build()
|
||||
.getPGPSecretKeyRing();
|
||||
Iterator<PGPPublicKey> keys = secretKeys.getPublicKeys();
|
||||
long primaryKeyId = keys.next().getKeyID();
|
||||
long signingKeyId = keys.next().getKeyID();
|
||||
long encryptKeyId = keys.next().getKeyID();
|
||||
KeyIdentifier primaryKeyId = keys.next().getKeyIdentifier();
|
||||
KeyIdentifier signingKeyId = keys.next().getKeyIdentifier();
|
||||
KeyIdentifier encryptKeyId = keys.next().getKeyIdentifier();
|
||||
|
||||
String p1 = "sw0rdf1sh";
|
||||
String p2 = "0r4ng3";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue