+static list_t *loadprivate_apply(closure_t *self, struct cloc loc,
+ dict_t *context, list_t *args)
+{
+ CL_GET_STR_ARG(0,algname,"algorithm name");
+ CL_GET_STR_ARG(1,path,"private key path");
+
+ const struct sigscheme_info *sch=sigscheme_lookup(algname);
+ if (!sch) cfgfatal(algname_i->loc,"load-private",
+ "unknown algorithm `%s'",algname);
+
+ struct buffer_if databuf;
+ buffer_new(&databuf,DEFAULT_MAXPRIV_BYTES);
+ BUF_ALLOC(&databuf,"load-private data buf");
+
+ struct hash_if *defhash=
+ find_cl_if(context,"hash",CL_HASH,False,"load-private",loc);
+
+ struct sigprivkey_if *sigpriv;
+ closure_t *cl;
+ bool_t ok=
+ uncached_load_file(sch,path,&databuf,defhash,&sigpriv,&cl,system_log);
+ if (!ok) cfgfatal(loc,"load-private","private key loading failed");
+
+ BUF_FREE(&databuf);
+ buffer_destroy(&databuf);
+ return new_closure(cl);
+}
+