Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var username = "{your username}";
- var password = "{your password}";
- username = "bo@demo";
- password = "123";
- var ticketHeader = api.GetPublicKey("Test", "F52D2965BF8318F", out string publicKey);
- if (publicKey == null)
- {
- throw new Exception("Can not get public key.");
- }
- RSACryptoServiceProvider key = new RSACryptoServiceProvider();
- key.FromXmlString(publicKey);
- UnicodeEncoding enc = new UnicodeEncoding();
- byte[] encryptedPassword;
- encryptedPassword = key.Encrypt(enc.GetBytes(password), false);
- if (api.Login(ticketHeader, username, encryptedPassword) == false)
- {
- throw new Exception("Login failed.");
- }
Advertisement
Add Comment
Please, Sign In to add comment