Created
July 13, 2022 21:08
-
-
Save cheeseonamonkey/331b94e614837e6f78fbc97fb37a338f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bouncycastle.openpgp.PGPPublicKey | |
import java.security.* | |
import org.pgpainless.* | |
import org.pgpainless.key.generation.type.rsa.RsaLength | |
import org.pgpainless.key.util.KeyRingUtils | |
import java.util.* | |
fun main() { | |
println("\n_________________________\nHello beautiful! ;)\n_________________________\n") | |
/* | |
//keypair no libraries | |
val keyGen :KeyPairGenerator = | |
KeyPairGenerator.getInstance("RSA") | |
//1024 bit encryption | |
keyGen.initialize(1024) | |
// | |
val keyPair = keyGen.generateKeyPair() | |
println("PRIVATE:\n${keyPair.private}\n\n") | |
println("PUBLIC:\n${keyPair.public}\n\n") | |
*/ | |
// | |
//pgp painless: | |
val keyRing = PGPainless.generateKeyRing().simpleRsaKeyRing("[email protected]", RsaLength._2048) | |
//println("\n\nPRIVATE:\n________\n${keyRing.secretKey}\n") | |
println("\n\nPUBLIC:\n________\n${ | |
Base64.getMimeEncoder().encodeToString( | |
keyRing.publicKey.encoded | |
) | |
}\n") | |
println("\n\nPRIVATE PGP:\n________\n${PGPainless.asciiArmor(keyRing)}\n") | |
println("") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment