mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Rework OnePassSignatureCheck
This commit is contained in:
parent
3c28660f26
commit
1e2e9c2125
1 changed files with 16 additions and 9 deletions
|
@ -5,31 +5,38 @@
|
|||
package org.pgpainless.signature.consumer
|
||||
|
||||
import org.bouncycastle.openpgp.PGPOnePassSignature
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing
|
||||
import org.bouncycastle.openpgp.PGPSignature
|
||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate
|
||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate.OpenPGPComponentKey
|
||||
import org.pgpainless.bouncycastle.extensions.getSigningKeyFor
|
||||
import org.pgpainless.key.SubkeyIdentifier
|
||||
|
||||
/**
|
||||
* Tuple-class that bundles together a [PGPOnePassSignature] object, a [PGPPublicKeyRing] destined
|
||||
* to verify the signature, the [PGPSignature] itself and a record of whether the signature was
|
||||
* verified.
|
||||
* Tuple-class that bundles together a [PGPOnePassSignature] object, an [OpenPGPCertificate]
|
||||
* destined to verify the signature.
|
||||
*
|
||||
* @param onePassSignature the one-pass-signature packet
|
||||
* @param verificationKeys certificate containing the signing subkey
|
||||
* @param signature the signature packet
|
||||
*/
|
||||
data class OnePassSignatureCheck(
|
||||
val onePassSignature: PGPOnePassSignature,
|
||||
val verificationKeys: OpenPGPCertificate,
|
||||
var signature: PGPSignature? = null
|
||||
val verificationKeys: OpenPGPCertificate
|
||||
) {
|
||||
|
||||
var signature: PGPSignature? = null
|
||||
|
||||
constructor(
|
||||
onePassSignature: PGPOnePassSignature,
|
||||
verificationKey: OpenPGPComponentKey
|
||||
) : this(onePassSignature, verificationKey.certificate)
|
||||
|
||||
val signingKey: OpenPGPComponentKey? = verificationKeys.getSigningKeyFor(onePassSignature)
|
||||
|
||||
/**
|
||||
* Return an identifier for the signing key.
|
||||
*
|
||||
* @return signing key fingerprint
|
||||
*/
|
||||
val signingKey: SubkeyIdentifier
|
||||
get() = SubkeyIdentifier(verificationKeys.pgpPublicKeyRing, onePassSignature.keyID)
|
||||
val signingKeyIdentifier: SubkeyIdentifier?
|
||||
get() = signingKey?.let { SubkeyIdentifier(it) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue