func NewDefaultLeafPem(group string, pemBlock []byte) (*DefaultLeaf, error) {
	certs, signers, err := UnmarshalPemData(pemBlock)
	if err != nil {
		return nil, errors.Trace(err)
	}

	if len(certs) == 0 {
		return nil, errors.New("found zero certificates in pem bundle")
	}
	if len(signers) != 1 {
		return nil, errors.New("expected at least one private key in bundle")
	}
	if !PublicKeysEqual(signers[0].Public(), certs[0].PublicKey) {
		return nil, errors.New("public keys of first certificate and key do not match")
	}

	return NewDefaultLeaf(group, certs[0], certs[1:], signers[0]), nil
}
// NewDefaultLeafPem constructs a new DefaultLeaf from the supplied PEM data
NewDefaultLeafPem constructs a new DefaultLeaf from the supplied PEM data
// NewDefaultLeafPem constructs a new DefaultLeaf from the supplied PEM data
func NewDefaultLeafPem(group string, pemBlock []byte) (*DefaultLeaf, error) {
	certs, signers, err := UnmarshalPemData(pemBlock)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if len(certs) == 0 {
		return nil, errors.New("found zero certificates in pem bundle")
	}
	if len(signers) != 1 {
		return nil, errors.New("expected at least one private key in bundle")
	}
	if !PublicKeysEqual(signers[0].Public(), certs[0].PublicKey) {
		return nil, errors.New("public keys of first certificate and key do not match")
	}
	return NewDefaultLeaf(group, certs[0], certs[1:], signers[0]), nil
}
func NewDefaultLeafPem ( group string , pemBlock [ ] byte ) ( * DefaultLeaf , error ) { certs , signers , err := UnmarshalPemData ( pemBlock ) if err != nil { return nil , errors . Trace ( err ) } if len ( certs ) == 0 { return nil , errors . New ( " " ) } if len ( signers ) != 1 { return nil , errors . New ( " " ) } if ! PublicKeysEqual ( signers [ 0 ] . Public ( ) , certs [ 0 ] . PublicKey ) { return nil , errors . New ( " " ) } return NewDefaultLeaf ( group , certs [ 0 ] , certs [ 1 : ] , signers [ 0 ] ) , nil }
NewDefaultLeafPem constructs a new DefaultLeaf from the supplied PEM data
NewDefaultLeafPem constructs a new DefaultLeaf from the supplied PEM data