Ejemplo n.º 1
0
        public UnityCryptoManager()
        {
            m_RSA_Exch_Formatter = new RiaWebSoftRu.Cryptography.Crypto.Formater.RSAESPKCSFormater();
            m_RSA = new RiaWebSoftRu.Cryptography.Crypto.RsaManaged(m_KeySize);
            m_SHA = new SHA256Managed();
            m_RIJ = new AesManaged();
            //m_RSA.GenerateKey(); Not necessary in unity.  Unity clients gets a public key from server and uses that to encrypt the Rijndael key

            m_SHA                    = new SHA256Managed();

            m_RIJ.Padding            = PaddingMode.PKCS7;
            m_RIJ.Mode               = CipherMode.CBC;
            m_RIJ.IV                 = new byte[16];
            m_RIJ.BlockSize          = 128;
            m_RIJ.KeySize            = 256;
            m_RIJ.GenerateKey();

            m_PublicKey = Encoding.UTF8.GetBytes(m_RSA.ToXmlString(false).ToString());
            m_PrivateKey = Encoding.UTF8.GetBytes(m_RSA.ToXmlString(true).ToString());
        }