コード例 #1
0
        private void encrypt_Click(object sender, RibbonControlEventArgs e)
        {
            //Word.Document doc
            String plain = Globals.ThisAddIn.Application.Selection.Text;

            CFB cfb = new CFB(Encoding.ASCII.GetBytes(plain), null, defaultkey, defaultIV);
            byte[] resbyte = cfb.encrypt();
            Globals.ThisAddIn.Application.Selection.Text = ByteArrayToString(resbyte);
        }
コード例 #2
0
        private void decrypt_Click(object sender, RibbonControlEventArgs e)
        {
            String cipher = Globals.ThisAddIn.Application.Selection.Text;

            CFB cfb = new CFB(null, StringToByteArray(cipher), defaultkey, defaultIV);
            byte[] resbyte = cfb.decrypt();

            Globals.ThisAddIn.Application.Selection.Text = Encoding.ASCII.GetString(resbyte);
        }