1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 10:49:39 +02:00

Kotlin conversion: XDH

This commit is contained in:
Paul Schaub 2023-09-07 15:29:08 +02:00
parent 521424c23a
commit ad734ca1b4
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
5 changed files with 21 additions and 69 deletions

View file

@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.generation.type.xdh
import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
import org.pgpainless.algorithm.PublicKeyAlgorithm
import org.pgpainless.key.generation.type.KeyType
class XDH private constructor(spec: XDHSpec): KeyType {
override val name = "XDH"
override val algorithm = PublicKeyAlgorithm.ECDH
override val bitStrength = spec.bitStrength
override val algorithmSpec = ECNamedCurveGenParameterSpec(spec.algorithmName)
companion object {
@JvmStatic
fun fromSpec(spec: XDHSpec) = XDH(spec)
}
}