Add constant for the RSA magic byte

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 7b6c0cf1fd
commit e9e7b7848d
  1. 6
      crypto/src/main/kotlin/org/openrs2/crypto/Rsa.kt

@ -73,6 +73,12 @@ public object Rsa {
// 1 in 2^80 // 1 in 2^80
private const val CERTAINTY = 80 private const val CERTAINTY = 80
/*
* The magic number prepended as a byte to the plaintext before it is
* encrypted by the server.
*/
public const val MAGIC: Int = 10
public fun generateKeyPair(length: Int): Pair<RSAKeyParameters, RSAPrivateCrtKeyParameters> { public fun generateKeyPair(length: Int): Pair<RSAKeyParameters, RSAPrivateCrtKeyParameters> {
val generator = RSAKeyPairGenerator() val generator = RSAKeyPairGenerator()
generator.init(RSAKeyGenerationParameters(F4, secureRandom, length, CERTAINTY)) generator.init(RSAKeyGenerationParameters(F4, secureRandom, length, CERTAINTY))

Loading…
Cancel
Save