/// <summary>
        /// Creates public/private RSA keys, individual pair for every session.
        /// </summary>
        /// <returns></returns>
        public static RsaParametersDbo GetPublicKey()
        {
            CspParameters cspParams = new CspParameters();

            cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
            var myRSA = new RSACryptoServiceProvider(cspParams);

            if (String.IsNullOrEmpty(MyRSA))
            {
                MyRSA = myRSA.ToXmlString(true);
            }

            myRSA.FromXmlString(MyRSA);

            RSAParameters param = myRSA.ExportParameters(false);
            var           rzlt  = new RsaParametersDbo()
            {
                Exponent = ToHexString(param.Exponent),
                Modulus  = ToHexString(param.Modulus)
            };

            return(rzlt);
        }
        /// <summary>
        /// Creates public/private RSA keys, individual pair for every session.
        /// </summary>
        /// <returns></returns>
        public static RsaParametersDbo GetPublicKey()
        {
            CspParameters cspParams = new CspParameters();
            cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
            var myRSA = new RSACryptoServiceProvider(cspParams);
            if ( String.IsNullOrEmpty(MyRSA))
                MyRSA = myRSA.ToXmlString(true);

            myRSA.FromXmlString(MyRSA);

            RSAParameters param = myRSA.ExportParameters(false);
            var rzlt = new RsaParametersDbo()
            {
                Exponent = ToHexString(param.Exponent),
                Modulus = ToHexString(param.Modulus)
            };
            return rzlt;
        }
Exemplo n.º 3
0
 protected void _Default_PreInit(object sender, EventArgs e)
 {
     rsaParam = CfcWebService.GetPublicKey();
 }
Exemplo n.º 4
0
 protected void _Default_PreInit(object sender, EventArgs e)
 {
     rsaParam = CfcWebService.GetPublicKey();
 }