func generatePrivateKey() ([]byte, error) {
	var keyData []byte
	key, err := rsa.GenerateKey(rand.Reader, 1024)
	if err != nil {
		return nil, errors.Wrap(err, "error generating key")
	}
	var privateKey = &pem.Block{
		Type:  "RSA PRIVATE KEY",
		Bytes: x509.MarshalPKCS1PrivateKey(key),
	}
	buf := bytes.NewBuffer(keyData)
	err = pem.Encode(buf, privateKey)
	if err != nil {
		return nil, errors.Wrap(err, "error encoding generated private key")
	}
	return buf.Bytes(), nil
}
// generatePrivateKey generates a random RSA private key
generatePrivateKey generates a random RSA private key
// generatePrivateKey generates a random RSA private key
func generatePrivateKey() ([]byte, error) {
	var keyData []byte
	key, err := rsa.GenerateKey(rand.Reader, 1024)
	if err != nil {
		return nil, errors.Wrap(err, "error generating key")
	}
	var privateKey = &pem.Block{
		Type:  "RSA PRIVATE KEY",
		Bytes: x509.MarshalPKCS1PrivateKey(key),
	}
	buf := bytes.NewBuffer(keyData)
	err = pem.Encode(buf, privateKey)
	if err != nil {
		return nil, errors.Wrap(err, "error encoding generated private key")
	}
	return buf.Bytes(), nil
}
func generatePrivateKey ( ) ( [ ] byte , error ) { var keyData [ ] byte key , err := rsa . GenerateKey ( rand . Reader , 1024 ) if err != nil { return nil , errors . Wrap ( err , " " ) } var privateKey = & pem . Block { Type : " " , Bytes : x509 . MarshalPKCS1PrivateKey ( key ) , } buf := bytes . NewBuffer ( keyData ) err = pem . Encode ( buf , privateKey ) if err != nil { return nil , errors . Wrap ( err , " " ) } return buf . Bytes ( ) , nil }
generatePrivateKey generates a random RSA private key
generatePrivateKey generates a random RSA private key