Exemplo n.º 1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            //sender's public key
            publicKeyPath = Environment.CurrentDirectory + @"\keys\sender\pub.bpg";
            //resiver's private key
            privateKeyPath = Environment.CurrentDirectory + @"\keys\reciver\secret.bpg";
            //pass phrase
            passPhrase = "ajar";

            PgpEncryptionKeys kes = new PgpEncryptionKeys(this.publicKeyPath, this.privateKeyPath, this.passPhrase);

            PgpDecrypt decFile = new PgpDecrypt(kes);

            using (var encStream = File.OpenRead(Environment.CurrentDirectory + "\\Шаляпин.doc.bpg"))
            {
                decFile.VerifySignature(encStream, @"D:\Temp");
            }

        }
Exemplo n.º 2
0
        public bool proccessIncomingMsg(ref string errorReason)
        {
            if (EMsgTmpFile == null)
            {
                errorReason = "Отсутсвует файл";
                return false;
            }

            string password = "******";  //////////////***********Пароль***********////////////////////
            byte[] keyFile = new byte[] { };    //////////////***********Файл***********////////////////////

            BinaryFormatter bf = new BinaryFormatter();
            BundleFile recivedFile = (BundleFile)bf.Deserialize(EMsgTmpFile.InputStream);

            PgpEncryptionKeys _keys = new PgpEncryptionKeys("pub.gpg", password, keyFile);
            using (Stream strm = new MemoryStream(recivedFile.EncryptedSignedFile))
            {
                PgpDecrypt decryptor = new PgpDecrypt(_keys);
                decryptor.VerifySignature(strm, null);
            }

            return false;
        }