示例#1
0
        public void Decrypt(string fileToDecrypt, string passPhrase)
        {
            var publicKeyFiles  = Directory.GetFiles(@"keys", "*.pkr");
            var privateKeyFiles = Directory.GetFiles(@"keys", "*.skr");

            if (publicKeyFiles.Length == 0 || privateKeyFiles.Length == 0)
            {
                Console.Write("There are no key files generated. Generate by using the keygen command.");
                return;
            }

            var privateKey = privateKeyFiles[0];

            var pgp = new PGPEncryptionHelper();

            pgp.Decrypt(fileToDecrypt, privateKey, passPhrase, "");
        }
示例#2
0
        public bool Encrypt(string fileToEncrypt)
        {
            var publicKeyFiles  = Directory.GetFiles(@"keys", "*.pkr");
            var privateKeyFiles = Directory.GetFiles(@"keys", "*.skr");

            if (publicKeyFiles.Length == 0 || privateKeyFiles.Length == 0)
            {
                Console.Write("There are no key files generated. Generate by using the keygen command.");
                return(false);
            }

            var publicKey  = publicKeyFiles[0];
            var privateKey = privateKeyFiles[0];

            var pgp = new PGPEncryptionHelper();

            pgp.Encrypt(fileToEncrypt, publicKey, $"");
            return(true);
        }