func (a *DefaultAuthority) LeafGroupFromPemCertKey(group string,
	certPem, key []byte) (Leaf, error) {

	groupKey := strings.ToLower(group)
	certs, signers, err := UnmarshalPemData(append(certPem, key...))
	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")
	}

	leaf := NewDefaultLeaf(groupKey, certs[0], certs[1:], signers[0])

	if _, exists := a.leafs.LoadOrStore(groupKey, leaf); exists {
		return nil, errors.AlreadyExistsf("leaf for group %s", group)
	}
	return leaf, nil
}
// LeafGroupFromPemCertKey implements Authority interface method.
LeafGroupFromPemCertKey implements Authority interface method.
// LeafGroupFromPemCertKey implements Authority interface method .
func (a *DefaultAuthority) LeafGroupFromPemCertKey(group string,
	certPem, key []byte) (Leaf, error) {
	groupKey := strings.ToLower(group)
	certs, signers, err := UnmarshalPemData(append(certPem, key...))
	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")
	}
	leaf := NewDefaultLeaf(groupKey, certs[0], certs[1:], signers[0])
	if _, exists := a.leafs.LoadOrStore(groupKey, leaf); exists {
		return nil, errors.AlreadyExistsf("leaf for group %s", group)
	}
	return leaf, nil
}
func ( a * DefaultAuthority ) LeafGroupFromPemCertKey ( group string , certPem , key [ ] byte ) ( Leaf , error ) { groupKey := strings . ToLower ( group ) certs , signers , err := UnmarshalPemData ( append ( certPem , key ... ) ) 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 ( " " ) } leaf := NewDefaultLeaf ( groupKey , certs [ 0 ] , certs [ 1 : ] , signers [ 0 ] ) if _ , exists := a . leafs . LoadOrStore ( groupKey , leaf ) ; exists { return nil , errors . AlreadyExistsf ( " " , group ) } return leaf , nil }
LeafGroupFromPemCertKey implements Authority interface method.
LeafGroupFromPemCertKey implements Authority interface method .