mirror of https://github.com/usbharu/Hideout.git
fix: 鍵を強固に、PEMを修正
This commit is contained in:
parent
099428ef00
commit
4a689901d9
|
@ -31,7 +31,7 @@ class UserAuthService(
|
||||||
|
|
||||||
override suspend fun generateKeyPair(): KeyPair {
|
override suspend fun generateKeyPair(): KeyPair {
|
||||||
val keyPairGenerator = KeyPairGenerator.getInstance("RSA")
|
val keyPairGenerator = KeyPairGenerator.getInstance("RSA")
|
||||||
keyPairGenerator.initialize(1024)
|
keyPairGenerator.initialize(2048)
|
||||||
return keyPairGenerator.generateKeyPair()
|
return keyPairGenerator.generateKeyPair()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ class UserAuthService(
|
||||||
fun PublicKey.toPem(): String {
|
fun PublicKey.toPem(): String {
|
||||||
return "-----BEGIN PUBLIC KEY-----\n" +
|
return "-----BEGIN PUBLIC KEY-----\n" +
|
||||||
Base64.getEncoder().encodeToString(encoded).chunked(64).joinToString("\n") +
|
Base64.getEncoder().encodeToString(encoded).chunked(64).joinToString("\n") +
|
||||||
"\n-----END PUBLIC KEY-----"
|
"\n-----END PUBLIC KEY-----\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PrivateKey.toPem(): String {
|
fun PrivateKey.toPem(): String {
|
||||||
return "-----BEGIN PRIVATE KEY-----\n" +
|
return "-----BEGIN PRIVATE KEY-----\n" +
|
||||||
Base64.getEncoder().encodeToString(encoded).chunked(64).joinToString("\n") +
|
Base64.getEncoder().encodeToString(encoded).chunked(64).joinToString("\n") +
|
||||||
"\n-----END PRIVATE KEY-----"
|
"\n-----END PRIVATE KEY-----\n"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue