Skip to content

Instantly share code, notes, and snippets.

@MCMXCIII
Created November 27, 2020 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MCMXCIII/b837c0d838fffd246dea235b7cb385fb to your computer and use it in GitHub Desktop.
Save MCMXCIII/b837c0d838fffd246dea235b7cb385fb to your computer and use it in GitHub Desktop.
GenRsa Generate.go
func main() {
reader := rand.Reader
bitSize := 2048
key, err := rsa.GenerateKey(reader, bitSize)
checkError(err)
publicKey := key.PublicKey
saveGobKey("private.key", key)
savePEMKey("private.pem", key)
saveGobKey("public.key", publicKey)
savePublicPEMKey("public.pem", publicKey)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment