func IsPkcs11PrivateKey(yamlstr []byte) bool {
	_, err := ParsePkcs11KeyFile(yamlstr)
	return err == nil
}
IsPkcs11PrivateKey checks whether the given YAML represents a Pkcs11 private key
package pkcs11
import (
	"fmt"
	"github.com/pkg/errors"
	pkcs11uri "github.com/stefanberger/go-pkcs11uri"
	"gopkg.in/yaml.v2"
)
type Pkcs11KeyFile struct {
	Pkcs11 struct {
		Uri string `yaml:"uri"`
	} `yaml:"pkcs11"`
	Module struct {
		Env map[string]string `yaml:"env,omitempty"`
	} `yaml:"module"`
}
type Pkcs11KeyFileObject struct {
	Uri *pkcs11uri.Pkcs11URI
}
func ParsePkcs11Uri(uri string) (*pkcs11uri.Pkcs11URI, error) {
	p11uri := pkcs11uri.New()
	err := p11uri.Parse(uri)
	if err != nil {
		return nil, errors.Wrapf(err, "Could not parse Pkcs11URI from file")
	}
	return p11uri, err
}
func ParsePkcs11KeyFile(yamlstr []byte) (*Pkcs11KeyFileObject, error) {
	p11keyfile := Pkcs11KeyFile{}
	err := yaml.Unmarshal([]byte(yamlstr), &p11keyfile)
	if err != nil {
		return nil, errors.Wrapf(err, "Could not unmarshal pkcs11 keyfile")
	}
	p11uri, err := ParsePkcs11Uri(p11keyfile.Pkcs11.Uri)
	if err != nil {
		return nil, err
	}
	p11uri.SetEnvMap(p11keyfile.Module.Env)
	return &Pkcs11KeyFileObject{Uri: p11uri}, err
}