Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. privateKey, err := rsa.GenerateKey(rand.Reader,2048)
  2.  
  3. privKey := pem.EncodeToMemory(&pem.Block{
  4. Type: "RSA PRIVATE KEY",
  5. Bytes: x509.MarshalPKCS1PrivateKey(privateKey),
  6. })
  7. pubKey := pem.EncodeToMemory(&pem.Block{
  8. Type: "RSA PUBLIC KEY",
  9. Bytes: x509.MarshalPKCS1PublicKey(&privateKey.PublicKey),
  10. })
  11.  
  12. fmt.Println("------------------------")
  13. fmt.Println(string(privKey))
  14. fmt.Println("------------------------")
  15. fmt.Println(string(pubKey))
  16. fmt.Println("------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement