Beispiel #1
0
        public static SecureChatUser CreateChatUser(string nickname, string guid)
        {
            SecureChatUser user = new SecureChatUser {
                GUID = guid, NickName = nickname, IsVisibleToSearch = false
            };

            user.UserInfo = new SecureChatUserInfo();

            RSA_AsymetricEncryption rsaAsymetricEncryption = new RSA_AsymetricEncryption();
            RSAKeySetIdentity       rsaKeySet = rsaAsymetricEncryption.GenerateRSAKeyPair(RSA_AsymetricEncryption.RSAKeySize.b4096);

            user.User_Certificate   = rsaKeySet.RSA_PublicKey;
            user.User_PrivateKey    = rsaKeySet.RSA_PrivateKey;
            user.Server_Certificate = ServerKeyManager.KeyManager.ServerPublicKey;

            return(user);
        }
Beispiel #2
0
 private async Task <RSAKeySetIdentity> GenerateRSA_Keys()
 {
     return(await Task.Run(() => rsaAsymetricEncryption.GenerateRSAKeyPair(RSA_AsymetricEncryption.RSAKeySize.b4096)));
 }
Beispiel #3
0
 private void GenerateRSAKeyPair(RSA_AsymetricEncryption.RSAKeySize keySize)
 {
     isRunning         = true;
     rsaKeySetIdentity = _rsaAsymetricEncryption.GenerateRSAKeyPair(keySize);
     isRunning         = false;
 }