func bytesToPublicRSAKey(pub []byte) *rsa.PublicKey {
	block, _ := pem.Decode(pub)
	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)
		}
	}
	ifc, err := x509.ParsePKIXPublicKey(b)
	if err != nil {
		log.Fatal(err)
	}
	key, ok := ifc.(*rsa.PublicKey)
	if !ok {
		log.Fatal("Not Ok")
	}
	return key
}
// BytesToPublicKey bytes to public key
BytesToPublicKey bytes to public key
// BytesToPublicKey bytes to public key
func bytesToPublicRSAKey(pub []byte) *rsa.PublicKey {
	block, _ := pem.Decode(pub)
	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)
		}
	}
	ifc, err := x509.ParsePKIXPublicKey(b)
	if err != nil {
		log.Fatal(err)
	}
	key, ok := ifc.(*rsa.PublicKey)
	if !ok {
		log.Fatal("Not Ok")
	}
	return key
}
func bytesToPublicRSAKey ( pub [ ] byte ) * rsa . PublicKey { block , _ := pem . Decode ( pub ) 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 ) } } ifc , err := x509 . ParsePKIXPublicKey ( b ) if err != nil { log . Fatal ( err ) } key , ok := ifc . ( * rsa . PublicKey ) if ! ok { log . Fatal ( " " ) } return key }
BytesToPublicKey bytes to public key
BytesToPublicKey bytes to public key