summaryrefslogtreecommitdiff
path: root/common/src/main/kotlin/crypto/utils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/kotlin/crypto/utils.kt')
-rw-r--r--common/src/main/kotlin/crypto/utils.kt32
1 files changed, 16 insertions, 16 deletions
diff --git a/common/src/main/kotlin/crypto/utils.kt b/common/src/main/kotlin/crypto/utils.kt
index 4e272b15..2f98e064 100644
--- a/common/src/main/kotlin/crypto/utils.kt
+++ b/common/src/main/kotlin/crypto/utils.kt
@@ -78,6 +78,22 @@ object CryptoUtil {
}
/**
+ * Load an RSA public key from its components.
+ *
+ * @param exponent
+ * @param modulus
+ * @return key
+ */
+ fun loadRsaPublicKeyFromComponents(modulus: ByteArray, exponent: ByteArray): RSAPublicKey {
+ val modulusBigInt = BigInteger(1, modulus)
+ val exponentBigInt = BigInteger(1, exponent)
+
+ val keyFactory = KeyFactory.getInstance("RSA")
+ val tmp = RSAPublicKeySpec(modulusBigInt, exponentBigInt)
+ return keyFactory.generatePublic(tmp) as RSAPublicKey
+ }
+
+ /**
* Load an RSA public key from its binary X509 encoding.
*/
fun getRsaPublicFromPrivate(rsaPrivateCrtKey: RSAPrivateCrtKey): RSAPublicKey {
@@ -107,22 +123,6 @@ object CryptoUtil {
}
/**
- * Load an RSA public key from its components.
- *
- * @param exponent
- * @param modulus
- * @return key
- */
- fun loadRsaPublicKeyFromComponents(modulus: ByteArray, exponent: ByteArray): RSAPublicKey {
- val modulusBigInt = BigInteger(1, modulus)
- val exponentBigInt = BigInteger(1, exponent)
-
- val keyFactory = KeyFactory.getInstance("RSA")
- val tmp = RSAPublicKeySpec(modulusBigInt, exponentBigInt)
- return keyFactory.generatePublic(tmp) as RSAPublicKey
- }
-
- /**
* Hash an RSA public key according to the EBICS standard (EBICS 2.5: 4.4.1.2.3).
*/
fun getEbicsPublicKeyHash(publicKey: RSAPublicKey): ByteArray {