func (e *Entity) SignIdentity(identity string, signer *Entity, config *packet.Config) error {
	if signer.PrivateKey == nil {
		return errors.InvalidArgumentError("signing Entity must have a private key")
	}
	if signer.PrivateKey.Encrypted {
		return errors.InvalidArgumentError("signing Entity's private key must be decrypted")
	}
	ident, ok := e.Identities[identity]
	if !ok {
		return errors.InvalidArgumentError("given identity string not found in Entity")
	}

	sig := &packet.Signature{
		SigType:      packet.SigTypeGenericCert,
		PubKeyAlgo:   signer.PrivateKey.PubKeyAlgo,
		Hash:         config.Hash(),
		CreationTime: config.Now(),
		IssuerKeyId:  &signer.PrivateKey.KeyId,
	}
	if err := sig.SignUserId(identity, e.PrimaryKey, signer.PrivateKey, config); err != nil {
		return err
	}
	ident.Signatures = append(ident.Signatures, sig)
	return nil
}
// SignIdentity adds a signature to e, from signer, attesting that identity is
// associated with e. The provided identity must already be an element of
// e.Identities and the private key of signer must have been decrypted if
// necessary.
// If config is nil, sensible defaults will be used.
SignIdentity adds a signature to e, from signer, attesting that identity is
associated with e. The provided identity must already be an element of
e.Identities and the private key of signer must have been decrypted if
necessary.
If config is nil, sensible defaults will be used.
// SignIdentity adds a signature to e from signer attesting that identity is // associated with e . The provided identity must already be an element of // e . Identities and the private key of signer must have been decrypted if // necessary . // If config is nil sensible defaults will be used .
func (e *Entity) SignIdentity(identity string, signer *Entity, config *packet.Config) error {
	if signer.PrivateKey == nil {
		return errors.InvalidArgumentError("signing Entity must have a private key")
	}
	if signer.PrivateKey.Encrypted {
		return errors.InvalidArgumentError("signing Entity's private key must be decrypted")
	}
	ident, ok := e.Identities[identity]
	if !ok {
		return errors.InvalidArgumentError("given identity string not found in Entity")
	}
	sig := &packet.Signature{
		SigType:      packet.SigTypeGenericCert,
		PubKeyAlgo:   signer.PrivateKey.PubKeyAlgo,
		Hash:         config.Hash(),
		CreationTime: config.Now(),
		IssuerKeyId:  &signer.PrivateKey.KeyId,
	}
	if err := sig.SignUserId(identity, e.PrimaryKey, signer.PrivateKey, config); err != nil {
		return err
	}
	ident.Signatures = append(ident.Signatures, sig)
	return nil
}
func ( e * Entity ) SignIdentity ( identity string , signer * Entity , config * packet . Config ) error { if signer . PrivateKey == nil { return errors . InvalidArgumentError ( " " ) } if signer . PrivateKey . Encrypted { return errors . InvalidArgumentError ( " " ) } ident , ok := e . Identities [ identity ] if ! ok { return errors . InvalidArgumentError ( " " ) } sig := & packet . Signature { SigType : packet . SigTypeGenericCert , PubKeyAlgo : signer . PrivateKey . PubKeyAlgo , Hash : config . Hash ( ) , CreationTime : config . Now ( ) , IssuerKeyId : & signer . PrivateKey . KeyId , } if err := sig . SignUserId ( identity , e . PrimaryKey , signer . PrivateKey , config ) ; err != nil { return err } ident . Signatures = append ( ident . Signatures , sig ) return nil }
SignIdentity adds a signature to e, from signer, attesting that identity is
associated with e. The provided identity must already be an element of
e.Identities and the private key of signer must have been decrypted if
necessary.
SignIdentity adds a signature to e from signer attesting that identity is associated with e . The provided identity must already be an element of e . Identities and the private key of signer must have been decrypted if necessary .