// Token: 0x0600093B RID: 2363 RVA: 0x0004B6F0 File Offset: 0x000498F0 public void LoginAnonymous() { this.EnsureLoggedOut(); this.authenticatedLogin = false; Random random = new Random(); this.masterKey = new byte[16]; random.NextBytes(this.masterKey); byte[] array = new byte[16]; random.NextBytes(array); byte[] array2 = new byte[16]; random.NextBytes(array2); byte[] data = Crypto.EncryptAes(this.masterKey, array); byte[] array3 = Crypto.EncryptAes(array2, this.masterKey); byte[] array4 = new byte[32]; Array.Copy(array2, 0, array4, 0, 16); Array.Copy(array3, 0, array4, 16, array3.Length); AnonymousLoginRequest request = new AnonymousLoginRequest(data.ToBase64(), array4.ToBase64()); LoginRequest request2 = new LoginRequest(this.Request(request), null); LoginResponse loginResponse = this.Request <LoginResponse>(request2, null); this.sessionId = loginResponse.TemporarySessionId; }
/// <summary> /// Login anonymously to Mega.co.nz service /// </summary> /// <exception cref="ApiException">Throws if service is not available</exception> public void LoginAnonymous() { this.EnsureLoggedOut(); this.authenticatedLogin = false; Random random = new Random(); // Generate random master key this.masterKey = new byte[16]; random.NextBytes(this.masterKey); // Generate a random password used to encrypt the master key byte[] passwordAesKey = new byte[16]; random.NextBytes(passwordAesKey); // Generate a random session challenge byte[] sessionChallenge = new byte[16]; random.NextBytes(sessionChallenge); byte[] encryptedMasterKey = Crypto.EncryptAes(this.masterKey, passwordAesKey); // Encrypt the session challenge with our generated master key byte[] encryptedSessionChallenge = Crypto.EncryptAes(sessionChallenge, this.masterKey); byte[] encryptedSession = new byte[32]; Array.Copy(sessionChallenge, 0, encryptedSession, 0, 16); Array.Copy(encryptedSessionChallenge, 0, encryptedSession, 16, encryptedSessionChallenge.Length); // Request Mega Api to obtain a temporary user handle AnonymousLoginRequest request = new AnonymousLoginRequest(encryptedMasterKey.ToBase64(), encryptedSession.ToBase64()); string userHandle = this.Request(request); // Request Mega Api to retrieve our temporary session id LoginRequest request2 = new LoginRequest(userHandle, null); LoginResponse response2 = this.Request <LoginResponse>(request2); this.sessionId = response2.TemporarySessionId; }