zoukankan      html  css  js  c++  java
  • KeyXMLStrings.cs

    using System;
    using System.IO;
    using System.Security.Cryptography;
    using System.Text;

    namespace APress.DotNetSecurity.Chapter2.KeyXMLStrings
    {
        class KeyXMLStringsTester
        {
            static void Main(string[] args)
            {
                try
                {
                    RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)RSA.Create();
                    Console.WriteLine("RSA public/private key info in XML is:");
                    Console.WriteLine(rsa.ToXmlString(true));
                    Console.WriteLine();
                    Console.WriteLine("RSA public key info in XML is:");
                    Console.WriteLine(rsa.ToXmlString(false));
                }
                catch(CryptographicUnexpectedOperationException cuoe)
                {
                    Console.WriteLine("CryptographicUnexpectedOperationException:  "
                        + cuoe.Message);
                    Console.WriteLine(cuoe.StackTrace);
                }
                catch(CryptographicException ce)
                {
                    Console.WriteLine("CryptographicException:  " + ce.Message);
                    Console.WriteLine(ce.StackTrace);
                }
                catch(Exception ge)
                {
                    Console.WriteLine("Exception:  " + ge.GetType().Name + " " + ge.Message);
                    Console.WriteLine(ge.StackTrace);
                }
                finally
                {
                    Console.WriteLine("Press the return key to continue...");
                    Console.Read();
                }
            }
            private static String ArrayToHexString(byte[] ByteData)
            {
                StringBuilder retVal = new StringBuilder();
                
                foreach(byte b in ByteData)
                {
                    retVal.Append(b.ToString("X2"));
                    retVal.Append(" ");
                }
                retVal.Remove(retVal.Length - 1, 1);

                return retVal.ToString();
            }    
        }
    }
  • 相关阅读:
    机器翻译评测——BLEU算法详解 (新增 在线计算BLEU分值)
    机器翻译评测——一份评测集的艰辛制作过程
    机器翻译评测——一种检测批量译文是否参考机器翻译的方法
    Recall(召回率)and Precision(精确率)
    “图像识别技术”的一次实践体验
    kappa系数在大数据评测中的应用
    Linux下crontab的使用
    Bing的Translation API 接入
    Julia体验 语言特性 元编程,宏
    Windows多个应用程序共享全局变量,静态变量
  • 原文地址:https://www.cnblogs.com/shihao/p/2511225.html
Copyright © 2011-2022 走看看