mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 10:49:39 +02:00
ValidateUserIdImpl: throw CertUserIdNoMatch for unbound user-ids
This commit is contained in:
parent
8f24bcfb26
commit
df136adfab
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ import java.io.InputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate
|
import org.bouncycastle.openpgp.api.OpenPGPCertificate
|
||||||
import org.pgpainless.PGPainless
|
import org.pgpainless.PGPainless
|
||||||
|
import sop.exception.SOPGPException
|
||||||
import sop.operation.ValidateUserId
|
import sop.operation.ValidateUserId
|
||||||
|
|
||||||
class ValidateUserIdImpl(private val api: PGPainless) : ValidateUserId {
|
class ValidateUserIdImpl(private val api: PGPainless) : ValidateUserId {
|
||||||
|
@ -28,7 +29,9 @@ class ValidateUserIdImpl(private val api: PGPainless) : ValidateUserId {
|
||||||
return api.readKey().parseCertificates(certs).all { cert ->
|
return api.readKey().parseCertificates(certs).all { cert ->
|
||||||
authorities.all { authority ->
|
authorities.all { authority ->
|
||||||
cert.getUserId(userId)?.getCertificationBy(authority, validateAt)?.isValid == true
|
cert.getUserId(userId)?.getCertificationBy(authority, validateAt)?.isValid == true
|
||||||
}
|
} ||
|
||||||
|
throw SOPGPException.CertUserIdNoMatch(
|
||||||
|
"${cert.keyIdentifier} does not carry valid user-id '$userId'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue