mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-08 21:31:08 +01:00
WIP
This commit is contained in:
parent
6f3f988707
commit
510f8276e7
13 changed files with 333 additions and 81 deletions
|
|
@ -56,6 +56,12 @@ class GnuPGDummyKeyUtil private constructor() {
|
|||
* @return builder
|
||||
*/
|
||||
@JvmStatic fun modify(secretKeys: PGPSecretKeyRing) = Builder(secretKeys)
|
||||
|
||||
@JvmStatic fun serialToBytes(sn: Int) = byteArrayOf(
|
||||
(sn shr 24).toByte(),
|
||||
(sn shr(16)).toByte(),
|
||||
(sn shr(8)).toByte(),
|
||||
sn.toByte())
|
||||
}
|
||||
|
||||
class Builder(private val keys: PGPSecretKeyRing) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.pgpainless.bouncycastle.PolicyAdapter
|
|||
import org.pgpainless.bouncycastle.extensions.setAlgorithmSuite
|
||||
import org.pgpainless.decryption_verification.DecryptionBuilder
|
||||
import org.pgpainless.encryption_signing.EncryptionBuilder
|
||||
import org.pgpainless.hardware.HardwareTokenBackend
|
||||
import org.pgpainless.key.certification.CertifyCertificate
|
||||
import org.pgpainless.key.generation.KeyRingBuilder
|
||||
import org.pgpainless.key.generation.KeyRingTemplates
|
||||
|
|
@ -52,6 +53,8 @@ class PGPainless(
|
|||
val algorithmPolicy: Policy = Policy()
|
||||
) {
|
||||
|
||||
val hardwareTokenBackends = mutableListOf<HardwareTokenBackend>()
|
||||
|
||||
constructor(
|
||||
algorithmPolicy: Policy
|
||||
) : this(OpenPGPImplementation.getInstance(), algorithmPolicy)
|
||||
|
|
|
|||
|
|
@ -209,4 +209,8 @@ $algorithm of size $bitSize is not acceptable.""",
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GeneralKeyException(message: String,
|
||||
fingerprint: OpenPgpFingerprint
|
||||
) : KeyException(message, fingerprint)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package org.pgpainless.hardware
|
||||
|
||||
interface HardwareTokenBackend {
|
||||
fun listDeviceSerials(): List<ByteArray>
|
||||
|
||||
fun listKeyFingerprints(): Map<ByteArray, List<ByteArray>>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue