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

Kotlin conversion: RSA

This commit is contained in:
Paul Schaub 2023-09-07 15:24:02 +02:00
parent ca3ff6acce
commit ac245fb56b
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 25 additions and 56 deletions

View file

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key.generation.type.rsa
import org.pgpainless.algorithm.PublicKeyAlgorithm
import org.pgpainless.key.generation.type.KeyType
import java.security.spec.RSAKeyGenParameterSpec
/**
* Key type that specifies the RSA_GENERAL algorithm.
*/
class RSA private constructor(length: RsaLength): KeyType {
override val name = "RSA"
override val algorithm = PublicKeyAlgorithm.RSA_GENERAL
override val bitStrength = length.length
override val algorithmSpec = RSAKeyGenParameterSpec(length.length, RSAKeyGenParameterSpec.F4)
companion object {
@JvmStatic
fun withLength(length: RsaLength) = RSA(length)
}
}