コード例 #1
0
    RSACryptoServiceProvider ImportPublicKey(RSAKeySet keys)
    {
        RSAParameters rsaParams = new RSAParameters();

        rsaParams.Modulus  = keys.n;
        rsaParams.Exponent = keys.e;

        RSACryptoServiceProvider csp = new RSACryptoServiceProvider();

        csp.ImportParameters(rsaParams);
        return(csp);
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        /*switch (encryptionMode) {
         *  case (EncryptionMode.None):
         *      encryptionMethod = "None";
         *      break;
         *  case (EncryptionMode.AES):
         *      encryptionMethod = "AES";
         *      break;
         *  case (EncryptionMode.DES):
         *      encryptionMethod = "DES";
         *      break;
         *  case (EncryptionMode.DES3):
         *      encryptionMethod = "DES3";
         *      break;
         *  case (EncryptionMode.RSA):
         *      encryptionMethod = "RSA";
         *      break;
         * }
         */
        clientRSA = new RSACryptoServiceProvider(2048);
        var pubKey = clientRSA.ExportParameters(false);

        clientPublicKeys   = new RSAKeySet();
        clientPublicKeys.n = pubKey.Modulus;
        clientPublicKeys.e = pubKey.Exponent;

        ObjectInfoSet toSend = new ObjectInfoSet();

        toSend.data = new List <ObjectInfo>();
        for (int i = 0; i < parents.Length; i++)
        {
            toSend.data.Add(new ObjectInfo(parents[i]));
        }

        opening = true;
    }