Annotate crypto methods with @Jvm{Overloads,Static}

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 3 years ago
parent 26651618ef
commit 03e6c3dd81
  1. 1
      crypto/src/main/kotlin/org/openrs2/crypto/Pkcs12KeyStore.kt
  2. 2
      crypto/src/main/kotlin/org/openrs2/crypto/Whirlpool.kt
  3. 4
      crypto/src/main/kotlin/org/openrs2/crypto/Xtea.kt

@ -51,6 +51,7 @@ public class Pkcs12KeyStore private constructor(privateKeyEntry: KeyStore.Privat
private val SHA256_WITH_RSA = AlgorithmIdentifier(PKCSObjectIdentifiers.sha256WithRSAEncryption) private val SHA256_WITH_RSA = AlgorithmIdentifier(PKCSObjectIdentifiers.sha256WithRSAEncryption)
private val SHA256 = AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256) private val SHA256 = AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256)
@JvmStatic
public fun open(path: Path, signerName: String): Pkcs12KeyStore { public fun open(path: Path, signerName: String): Pkcs12KeyStore {
val keyStore = KeyStore.getInstance("PKCS12") val keyStore = KeyStore.getInstance("PKCS12")
if (Files.exists(path)) { if (Files.exists(path)) {

@ -266,6 +266,8 @@ public class Whirlpool {
} }
} }
@JvmOverloads
@JvmStatic
public fun whirlpool(data: ByteArray, off: Int = 0, len: Int = data.size): ByteArray { public fun whirlpool(data: ByteArray, off: Int = 0, len: Int = data.size): ByteArray {
val source: ByteArray val source: ByteArray
if (off <= 0) { if (off <= 0) {

@ -32,18 +32,22 @@ public data class XteaKey(
} }
public companion object { public companion object {
@JvmStatic
public val ZERO: XteaKey = XteaKey(0, 0, 0, 0) public val ZERO: XteaKey = XteaKey(0, 0, 0, 0)
@JvmStatic
public fun fromIntArray(a: IntArray): XteaKey { public fun fromIntArray(a: IntArray): XteaKey {
require(a.size == 4) require(a.size == 4)
return XteaKey(a[0], a[1], a[2], a[3]) return XteaKey(a[0], a[1], a[2], a[3])
} }
@JvmStatic
public fun fromHex(s: String): XteaKey { public fun fromHex(s: String): XteaKey {
return fromHexOrNull(s) ?: throw IllegalArgumentException() return fromHexOrNull(s) ?: throw IllegalArgumentException()
} }
@JvmStatic
public fun fromHexOrNull(s: String): XteaKey? { public fun fromHexOrNull(s: String): XteaKey? {
if (s.length != 32) { if (s.length != 32) {
return null return null

Loading…
Cancel
Save