Example #1
0
func Fuzz(data []byte) int {
	key, err := libkb.ReadOneKeyFromBytes(data)
	if err != nil {
		if key != nil {
			panic("key not nil on error")
		}
		return 0
	}
	return 1
}
Example #2
0
func NewPGPKeyImportEngineFromBytes(key []byte, pushPrivate bool, gc *libkb.GlobalContext) (eng *PGPKeyImportEngine, err error) {
	var bundle *libkb.PGPKeyBundle
	if libkb.IsArmored(key) {
		bundle, err = libkb.ReadPrivateKeyFromString(string(key))
	} else {
		bundle, err = libkb.ReadOneKeyFromBytes(key)
	}
	if err != nil {
		return
	}
	arg := PGPKeyImportEngineArg{
		Pregen:     bundle,
		PushSecret: pushPrivate,
		AllowMulti: true,
		DoExport:   false,
		DoUnlock:   true,
		Ctx:        gc,
	}
	eng = NewPGPKeyImportEngine(arg)
	return
}