Beispiel #1
0
        static public void Generate (Person person, Organization organization)
        {
            GnuPG generatingInstance = new GnuPG();
            generatingInstance.Timeout = 120000;
            generatingInstance.GenerateKeyPair(person.Name, person.PartyEmail, organization.Name,
                                        new DateTime(DateTime.Today.Year + 2, 12, 31));

            GnuPGKeyCollection keys = new GnuPG().GetKeys();
            foreach (GnuPGKey key in keys)
            {
                if (key.UserId == person.PartyEmail)
                {
                    // Console.Write(" signing...");
                    generatingInstance.SignKey(key.Fingerprint, "*****@*****.**");
                    // Console.Write(" uploading...");
                    generatingInstance.UploadKey(key.Fingerprint.Replace(" ", ""));
                    string armorSecret = new GnuPG().GetSecretKey(key.Fingerprint.Replace(" ", ""));
                    string armorPublic = new GnuPG().GetPublicKey(key.Fingerprint.Replace(" ", ""));
                    // Console.Write(" deleting...");
                    key.Delete();

                    person.CryptoPublicKey = armorPublic;
                    person.CryptoSecretKey = armorSecret;
                    person.CryptoFingerprint = key.Fingerprint;
                }
            }

        }
 public void Dispose()
 {
     if (_gpg != null) {
         _gpg.Dispose();
         _gpg = null;
     }
 }
        public GnuPgpProcessor(string goodDataPubKeyUserId, string keyPassphrase)
        {
            this.goodDataPubKeyUserId = goodDataPubKeyUserId;
            this.keyPassphrase = keyPassphrase;

            var path = new GpgPath();
            _gpg = new GnuPG(path.GetHomeFolderPath(), path.GetExeFolder());
        }
Beispiel #4
0
        private void OutlookGnuPG_Startup(object sender, EventArgs e)
        {
            _settings = new Properties.Settings();

              if (string.IsNullOrEmpty(_settings.GnuPgPath))
              {
            _gnuPg = new GnuPG();
            Settings(); // Prompt for GnuPG Path
              }
              else
              {
            _gnuPg = new GnuPG(null, _settings.GnuPgPath);
            if (!_gnuPg.BinaryExists())
            {
              _settings.GnuPgPath = string.Empty;
              Settings(); // Prompt for GnuPG Path
            }
              }
              _gnuPg.OutputType = OutputTypes.AsciiArmor;

              _WrappedObjects = new Dictionary<Guid, object>();

              // Initialize command bar.
              // Must be saved/closed in Explorer Close event.
              // See http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/df53276b-6b44-448f-be86-7dd46c3786c7/
              AddGnuPGCommandBar(this.Application.ActiveExplorer());

              // Register an event for ItemSend
              Application.ItemSend += Application_ItemSend;
            #if VSTO2008
              ((ApplicationEvents_11_Event)Application).Quit += OutlookGnuPG_Quit;
            #endif

              // Initialize the outlook explorers
              _explorers = this.Application.Explorers;
              _explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(OutlookGnuPG_NewExplorer);
              for (int i = _explorers.Count; i >= 1; i--)
              {
            WrapExplorer(_explorers[i]);
              }

              // Initialize the outlook inspectors
              _inspectors = this.Application.Inspectors;
              _inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookGnuPG_NewInspector);
        }
 public GnuPgpProcessor()
 {
     var path = new GpgPath();
     _gpg = new GnuPG(path.GetHomeFolderPath(), path.GetExeFolder());
 }