mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-23 04:42:06 +01:00
V6 sigs do not contain IssuerKeyId packet
This commit is contained in:
parent
4911816b7d
commit
8677646780
3 changed files with 20 additions and 3 deletions
|
@ -97,7 +97,7 @@ class KeyRingBuilder : KeyRingBuilderInterface<KeyRingBuilder> {
|
||||||
val signatureGenerator = PGPSignatureGenerator(signer, certKey.publicKey)
|
val signatureGenerator = PGPSignatureGenerator(signer, certKey.publicKey)
|
||||||
|
|
||||||
val hashedSubPacketGenerator = primaryKeySpec!!.subpacketGenerator
|
val hashedSubPacketGenerator = primaryKeySpec!!.subpacketGenerator
|
||||||
hashedSubPacketGenerator.setIssuerFingerprintAndKeyId(certKey.publicKey)
|
hashedSubPacketGenerator.setIssuer(certKey.publicKey)
|
||||||
expirationDate?.let { hashedSubPacketGenerator.setKeyExpirationTime(certKey.publicKey, it) }
|
expirationDate?.let { hashedSubPacketGenerator.setKeyExpirationTime(certKey.publicKey, it) }
|
||||||
if (userIds.isNotEmpty()) {
|
if (userIds.isNotEmpty()) {
|
||||||
hashedSubPacketGenerator.setPrimaryUserId()
|
hashedSubPacketGenerator.setPrimaryUserId()
|
||||||
|
|
|
@ -17,6 +17,15 @@ interface BaseSignatureSubpackets {
|
||||||
|
|
||||||
interface Callback : SignatureSubpacketCallback<BaseSignatureSubpackets>
|
interface Callback : SignatureSubpacketCallback<BaseSignatureSubpackets>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Depending on the key version, set appropriate issuer information (issuer key-id / issuer
|
||||||
|
* fingerprint).
|
||||||
|
*
|
||||||
|
* @param key issuer key
|
||||||
|
* @return signature subpackets
|
||||||
|
*/
|
||||||
|
fun setIssuer(key: PGPPublicKey): BaseSignatureSubpackets
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add both an [IssuerKeyID] and [IssuerFingerprint] subpacket pointing to the given key.
|
* Add both an [IssuerKeyID] and [IssuerFingerprint] subpacket pointing to the given key.
|
||||||
*
|
*
|
||||||
|
|
|
@ -72,7 +72,7 @@ class SignatureSubpackets :
|
||||||
issuer: PGPPublicKey,
|
issuer: PGPPublicKey,
|
||||||
base: PGPSignatureSubpacketVector
|
base: PGPSignatureSubpacketVector
|
||||||
): SignatureSubpackets {
|
): SignatureSubpackets {
|
||||||
return createSubpacketsFrom(base).apply { setIssuerFingerprintAndKeyId(issuer) }
|
return createSubpacketsFrom(base).apply { setIssuer(issuer) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -82,7 +82,7 @@ class SignatureSubpackets :
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun createHashedSubpackets(issuer: PGPPublicKey): SignatureSubpackets {
|
fun createHashedSubpackets(issuer: PGPPublicKey): SignatureSubpackets {
|
||||||
return createEmptySubpackets().setIssuerFingerprintAndKeyId(issuer)
|
return createEmptySubpackets().setIssuer(issuer)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -352,6 +352,14 @@ class SignatureSubpackets :
|
||||||
this.featuresSubpacket = features
|
this.featuresSubpacket = features
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setIssuer(key: PGPPublicKey): SignatureSubpackets = apply {
|
||||||
|
if (key.version == 6) {
|
||||||
|
setIssuerFingerprint(key)
|
||||||
|
} else {
|
||||||
|
setIssuerFingerprintAndKeyId(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun setIssuerFingerprintAndKeyId(key: PGPPublicKey): SignatureSubpackets = apply {
|
override fun setIssuerFingerprintAndKeyId(key: PGPPublicKey): SignatureSubpackets = apply {
|
||||||
setIssuerKeyId(key.keyID)
|
setIssuerKeyId(key.keyID)
|
||||||
setIssuerFingerprint(key)
|
setIssuerFingerprint(key)
|
||||||
|
|
Loading…
Reference in a new issue