mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
ValidateUserIdImpl: throw CertUserIdNoMatch for unbound user-ids
This commit is contained in:
parent
5691d09e5f
commit
c20c25a448
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ import java.io.InputStream
|
|||
import java.util.*
|
||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate
|
||||
import org.pgpainless.PGPainless
|
||||
import sop.exception.SOPGPException
|
||||
import sop.operation.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 ->
|
||||
authorities.all { authority ->
|
||||
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