예제 #1
0
        private async Task RequestPublicKeyAsync()
        {
            var keyInfoRequest  = new KeyInfoRequest();
            var keyInfoResponse = await SendRequestAsync <KeyInfoRequest, KeyInfoResponse>(keyInfoRequest, ConnectionMode.Plain);

            if (keyInfoResponse.Answer.Body.Error != null)
            {
                var error = keyInfoResponse.Answer.Body.Error;
                throw new SirenaException(error.ToString());
            }

            var publicKey = keyInfoResponse.Answer.Body.KeyManager.ServerPublicKey;

            clientSettings.PublicRsaKey = CryptographyHelper.PKCS1PublicKeyToRSAParameters(publicKey);
        }
예제 #2
0
 /// <summary>
 /// Asynchronously queues a KeyInfoRequest object in the SirenaClientPool instance.
 /// </summary>
 /// <param name="keyInfoRequest">The KeyInfoRequest request to send.</param>
 /// <returns>Returns the task object representing the asynchronous operation.</returns>
 public async Task <KeyInfoResponse> QueueRequestAsync(KeyInfoRequest keyInfoRequest)
 {
     return(await QueueRequestAsync <KeyInfoRequest, KeyInfoResponse>(keyInfoRequest));
 }
예제 #3
0
 /// <summary>
 /// Sends a KeyInfoRequest object to the Sirena server.
 /// </summary>
 /// <param name="keyInfoRequest">The KeyInfoRequest object to send.</param>
 /// <returns>Returns a KeyInfoResponse object contains the response.</returns>
 public KeyInfoResponse SendRequest(KeyInfoRequest keyInfoRequest)
 {
     return(SendRequest <KeyInfoRequest, KeyInfoResponse>(keyInfoRequest));
 }