Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- privateKey, err := rsa.GenerateKey(rand.Reader,2048)
- privKey := pem.EncodeToMemory(&pem.Block{
- Type: "RSA PRIVATE KEY",
- Bytes: x509.MarshalPKCS1PrivateKey(privateKey),
- })
- pubKey := pem.EncodeToMemory(&pem.Block{
- Type: "RSA PUBLIC KEY",
- Bytes: x509.MarshalPKCS1PublicKey(&privateKey.PublicKey),
- })
- fmt.Println("------------------------")
- fmt.Println(string(privKey))
- fmt.Println("------------------------")
- fmt.Println(string(pubKey))
- fmt.Println("------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement