title: cannot convert privateKey type pem.Block to type string
body: <p>i want to generate ssh key, public and private and return as string, but i dont know how i can convert type *pem.Block in string.</p>
  
  <p>this is my current code :</p>
  
  <pre><code>package main
  
  import (
      "crypto/rand"
      "crypto/rsa"
      "crypto/x509"
      "encoding/asn1"
      "encoding/pem"
      "fmt"
      "bytes"
      "bufio"
  )
  
  func Keymaker() {
      reader := rand.Reader
      bitSize := 2048
  
      key, err := rsa.GenerateKey(reader, bitSize)
      if err != nil {
          //return nil, nil, err
      }
  
      publicKey := key.PublicKey
  
      var privateKey = &amp;pem.Block{
          Type:  "PRIVATE KEY",
          Bytes: x509.MarshalPKCS1PrivateKey(key),
      }
  
      asn1Bytes, err := asn1.Marshal(publicKey)
      if err != nil {
          //return nil, nil, err
      }
  
      var pemkey = &amp;pem.Block{
          Type:  "PUBLIC KEY",
          Bytes: asn1Bytes,
      }
  
      var PublicKeyRow bytes.Buffer
  
      err = pem.Encode(bufio.NewWriter(&amp;PublicKeyRow), pemkey)
  
      fmt.Println("public_key : ", PublicKeyRow)
      fmt.Println("private_key : ", privateKey )
  
      return
  }
  
  
  func main() {
      Keymaker()
  
  }
  </code></pre>
  
  <p>and this is my current error:</p>
  
  <pre><code># command-line-arguments
  ./dkim.go:46:38: cannot convert privateKey (type *pem.Block) to type string
  </code></pre>
  
  <p>I need in string format because i want to store the key in database, how i can convert (type *pem.Block) to type string ? and how i can convert  (type bytes.Buffer) to type string ?</p>