func UnmarshalSignerFromPemBlock(block *pem.Block) (crypto.Signer, error) {
	switch blockType := block.Type; blockType {
	case PEMTypePKCS8:
		key, err := x509.ParsePKCS8PrivateKey(block.Bytes)
		if err != nil {
			return nil, errors.Annotate(err, "parsing pem private key")
		}
		signer, ok := key.(crypto.Signer)
		if !ok {
			return nil, errors.New("unable to case pem private key to crypto.Signer")
		}
		return signer, nil
	case PEMTypePKCS1:
		key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
		if err != nil {
			return nil, errors.Annotate(err, "parsing pem private key")
		}
		return key, nil
	default:
		return nil, errors.NotSupportedf("block type %s", blockType)
	}
}
// UnmarshalSignerFromPemBlock transforms a given pem block to a crypto signer
UnmarshalSignerFromPemBlock transforms a given pem block to a crypto signer
// UnmarshalSignerFromPemBlock transforms a given pem block to a crypto signer
func UnmarshalSignerFromPemBlock(block *pem.Block) (crypto.Signer, error) {
	switch blockType := block.Type; blockType {
	case PEMTypePKCS8:
		key, err := x509.ParsePKCS8PrivateKey(block.Bytes)
		if err != nil {
			return nil, errors.Annotate(err, "parsing pem private key")
		}
		signer, ok := key.(crypto.Signer)
		if !ok {
			return nil, errors.New("unable to case pem private key to crypto.Signer")
		}
		return signer, nil
	case PEMTypePKCS1:
		key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
		if err != nil {
			return nil, errors.Annotate(err, "parsing pem private key")
		}
		return key, nil
	default:
		return nil, errors.NotSupportedf("block type %s", blockType)
	}
}
func UnmarshalSignerFromPemBlock ( block * pem . Block ) ( crypto . Signer , error ) { switch blockType := block . Type ; blockType { case PEMTypePKCS8 : key , err := x509 . ParsePKCS8PrivateKey ( block . Bytes ) if err != nil { return nil , errors . Annotate ( err , " " ) } signer , ok := key . ( crypto . Signer ) if ! ok { return nil , errors . New ( " " ) } return signer , nil case PEMTypePKCS1 : key , err := x509 . ParsePKCS1PrivateKey ( block . Bytes ) if err != nil { return nil , errors . Annotate ( err , " " ) } return key , nil default : return nil , errors . NotSupportedf ( " " , blockType ) } }
UnmarshalSignerFromPemBlock transforms a given pem block to a crypto signer
UnmarshalSignerFromPemBlock transforms a given pem block to a crypto signer