Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1.         public Agent.Result SignResult (Agent.Result resut, string agentId) {
  2.             string salt = CryptoUtils.RandomString(32);
  3.             byte[] sign = null;
  4.             if (RSASigner.Sign(Encoding.UTF8.GetBytes(salt + agentId + resut.SessionId), privateKey, out sign)) {
  5.                 resut.Sign = new Agent.sign_data() {
  6.                     Salt = salt,
  7.                     Sign = Convert.ToBase64String(sign)
  8.                 };
  9.             } else {
  10.                 Log.Error(Ident, $"RSA sign failed for agent '{agentId}' session '{resut.SessionId}'");
  11.             }
  12.             return resut;
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement