RSA4K
A RSA Cipher implementation for Kotlin/Java.
Usage
Import
Replace ${version}
with the current version!
Gradle KTS
repositories {
maven("https://jitpack.io")
}
dependencies {
implementation("com.github.Lyzev:RSA4K:${version}")
}
Gradle Groovy
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.Lyzev:RSA4K:${version}'
}
Maven
jitpack.io
https://jitpack.io
com.github.Lyzev
RSA4K
${version}
Raw Jar
- Go to the release page.
- Download RSA4K-${version}-all.jar.
- Add the jar to your classpath.
Example
fun main() {
val keys = RSAKeyFactory.genKeyPair()
val cipher = RSA(keys.first, keys.second)
val msg = "Test"
val encrypted = cipher.encrypt(msg.encodeToByteArray())
val decrypted = String(cipher.decrypt(encrypted!!))
println("public exponent -> ${keys.first.exp}")
println("public modulus -> ${keys.first.mod}")
println("private exponent -> ${keys.second.exp}")
println("private modulus -> ${keys.second.mod}")
println("encrypted -> $encrypted")
println("decrypted -> $decrypted")
}
Documentation
You can find the documentation here.
Code Quality Monitoring
You can find the qodana report here.
Bugs and Suggestions
Bug reports and suggestions should be made in this repo's issue tracker using the templates provided. Please provide as much information as you can to best help us understand your issue and give a better chance of it being resolved.
Disclaimer
Please note that this repository is for educational purposes only. There may be some security issues, because the author isn't a professional cryptologist. It's recommend to use the rsa implementation of java.