func bytesToPrivateRSAKey(priv []byte) *rsa.PrivateKey {
	block, _ := pem.Decode(priv)
	enc := x509.IsEncryptedPEMBlock(block)
	b := block.Bytes
	var err error
	if enc {
		log.Println("is encrypted pem block")
		b, err = x509.DecryptPEMBlock(block, nil)
		if err != nil {
			log.Fatal(err)
		}
	}
	key, err := x509.ParsePKCS1PrivateKey(b)
	if err != nil {
		log.Fatal(err)
	}
	return key
}
// BytesToPrivateKey bytes to private key
BytesToPrivateKey bytes to private key
// BytesToPrivateKey bytes to private key
func bytesToPrivateRSAKey(priv []byte) *rsa.PrivateKey {
	block, _ := pem.Decode(priv)
	enc := x509.IsEncryptedPEMBlock(block)
	b := block.Bytes
	var err error
	if enc {
		log.Println("is encrypted pem block")
		b, err = x509.DecryptPEMBlock(block, nil)
		if err != nil {
			log.Fatal(err)
		}
	}
	key, err := x509.ParsePKCS1PrivateKey(b)
	if err != nil {
		log.Fatal(err)
	}
	return key
}
func bytesToPrivateRSAKey ( priv [ ] byte ) * rsa . PrivateKey { block , _ := pem . Decode ( priv ) enc := x509 . IsEncryptedPEMBlock ( block ) b := block . Bytes var err error if enc { log . Println ( " " ) b , err = x509 . DecryptPEMBlock ( block , nil ) if err != nil { log . Fatal ( err ) } } key , err := x509 . ParsePKCS1PrivateKey ( b ) if err != nil { log . Fatal ( err ) } return key }
BytesToPrivateKey bytes to private key
BytesToPrivateKey bytes to private key