func newEphemeralGPGSigningMechanism(blob []byte) (SigningMechanism, []string, error) {
	dir, err := ioutil.TempDir("", "containers-ephemeral-gpg-")
	if err != nil {
		return nil, nil, err
	}
	removeDir := true
	defer func() {
		if removeDir {
			os.RemoveAll(dir)
		}
	}()
	ctx, err := newGPGMEContext(dir)
	if err != nil {
		return nil, nil, err
	}
	mech := &gpgmeSigningMechanism{
		ctx:          ctx,
		ephemeralDir: dir,
	}
	keyIdentities, err := mech.importKeysFromBytes(blob)
	if err != nil {
		return nil, nil, err
	}

	removeDir = false
	return mech, keyIdentities, nil
}
func newEphemeralGPGSigningMechanism(blob []byte) (SigningMechanism, []string, error) {
	dir, err := ioutil.TempDir("", "containers-ephemeral-gpg-")
	if err != nil {
		return nil, nil, err
	}
	removeDir := true
	defer func() {
		if removeDir {
			os.RemoveAll(dir)
		}
	}()
	ctx, err := newGPGMEContext(dir)
	if err != nil {
		return nil, nil, err
	}
	mech := &gpgmeSigningMechanism{
		ctx:          ctx,
		ephemeralDir: dir,
	}
	keyIdentities, err := mech.importKeysFromBytes(blob)
	if err != nil {
		return nil, nil, err
	}

	removeDir = false
	return mech, keyIdentities, nil
}
func newEphemeralGPGSigningMechanism ( blob [ ] byte ) ( SigningMechanism , [ ] string , error ) { dir , err := ioutil . TempDir ( " " , " " ) if err != nil { return nil , nil , err } removeDir := true defer func ( ) { if removeDir { os . RemoveAll ( dir ) } } ( ) ctx , err := newGPGMEContext ( dir ) if err != nil { return nil , nil , err } mech := & gpgmeSigningMechanism { ctx : ctx , ephemeralDir : dir , } keyIdentities , err := mech . importKeysFromBytes ( blob ) if err != nil { return nil , nil , err } removeDir = false return mech , keyIdentities , nil }
// newEphemeralGPGSigningMechanism returns a new GPG/OpenPGP signing mechanism which
// recognizes _only_ public keys from the supplied blob, and returns the identities
// of these keys.
// The caller must call .Close() on the returned SigningMechanism.
newEphemeralGPGSigningMechanism returns a new GPG / OpenPGP signing mechanism which recognizes _only_ public keys from the supplied blob and returns the identities of these keys . The caller must call . Close () on the returned SigningMechanism .