mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Certify-UserId: Throw proper exception on unbound user-id
This commit is contained in:
parent
148af79794
commit
168c884f27
1 changed files with 2 additions and 6 deletions
|
@ -9,11 +9,10 @@ import java.io.OutputStream
|
||||||
import org.bouncycastle.bcpg.PacketFormat
|
import org.bouncycastle.bcpg.PacketFormat
|
||||||
import org.bouncycastle.openpgp.api.OpenPGPKey
|
import org.bouncycastle.openpgp.api.OpenPGPKey
|
||||||
import org.pgpainless.PGPainless
|
import org.pgpainless.PGPainless
|
||||||
import org.pgpainless.exception.KeyException.UnboundUserIdException
|
|
||||||
import org.pgpainless.key.OpenPgpFingerprint
|
|
||||||
import org.pgpainless.util.ArmoredOutputStreamFactory
|
import org.pgpainless.util.ArmoredOutputStreamFactory
|
||||||
import org.pgpainless.util.Passphrase
|
import org.pgpainless.util.Passphrase
|
||||||
import sop.Ready
|
import sop.Ready
|
||||||
|
import sop.exception.SOPGPException
|
||||||
import sop.operation.CertifyUserId
|
import sop.operation.CertifyUserId
|
||||||
|
|
||||||
class CertifyUserIdImpl(private val api: PGPainless) : CertifyUserId {
|
class CertifyUserIdImpl(private val api: PGPainless) : CertifyUserId {
|
||||||
|
@ -39,10 +38,7 @@ class CertifyUserIdImpl(private val api: PGPainless) : CertifyUserId {
|
||||||
// Check for non-bound user-ids
|
// Check for non-bound user-ids
|
||||||
userIds
|
userIds
|
||||||
.find { cert.getUserId(it)?.isBound != true }
|
.find { cert.getUserId(it)?.isBound != true }
|
||||||
?.let {
|
?.let { throw SOPGPException.CertUserIdNoMatch(cert.fingerprint) }
|
||||||
throw UnboundUserIdException(
|
|
||||||
OpenPgpFingerprint.Companion.of(cert), it, null, null)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.forEach { cert ->
|
.forEach { cert ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue