public BiKeyPair HandleKey(HandleKeyParams spec) {
     if (spec.Key == null) {
         spec.Key = GetDefaultPrivateKeyPath(spec.KeyPath, spec.Prefix,
             spec.Directory);
     }
     var signKey = new BiKeyPair(spec.Key);
     if (!signKey.PrivateFile.Exists)
         BiKeyPair.CreateKey(Path.Combine(signKey.Location, signKey.Name).ToAbsoluteFilePath(), _pboTools);
     if (spec.CopyKey)
         CopyKeyToKeysSubfolder(signKey, spec.Directory);
     return signKey;
 }
 public void SignAllInFolder(IAbsoluteDirectoryPath folder, BiKeyPair key) {
     SignFolderRecursively(folder, key.PrivateFile);
 }
 public void SignFolder(IAbsoluteDirectoryPath folder, BiKeyPair key) {
     _biSigner.SignFolder(folder, key.PrivateFile);
 }
 public void SignFile(IAbsoluteFilePath file, BiKeyPair key) {
     _biSigner.SignFile(file, key.PrivateFile);
 }
 static void CopyKeyToKeysSubfolder(BiKeyPair key, IAbsoluteDirectoryPath destination) {
     var keysFolder = destination.GetChildDirectoryWithName("keys");
     keysFolder.MakeSurePathExists();
     Tools.FileUtil.Ops.CopyWithRetry(key.PublicFile,
         keysFolder.GetChildFileWithName(key.PublicFile.FileName));
 }