Пример #1
0
        /// <summary>
        /// Calculates/Generates Secrets and KeyResponse given an incoming KeyRequest.
        /// </summary>
        /// <param name="keyRequest"></param>
        /// <returns>Secrets and KeyResponse to send back.</returns>
        public static SecretsAndKeyResponse GenerateSecretsAndKeyResponse(KeyRequest keyRequest)
        {
            var encPubAndSec = _calculateMyPublicKeyAndSecret(keyRequest.Aenc);
            var Benc         = encPubAndSec.MyPublicKey;
            var Senc         = encPubAndSec.SharedSecretKey;

            var hmacPubAndSec = _calculateMyPublicKeyAndSecret(keyRequest.Ahmac);
            var Bhmac         = hmacPubAndSec.MyPublicKey;
            var Shmac         = hmacPubAndSec.SharedSecretKey;

            var secrets     = new Secrets(Senc, Shmac);
            var keyResponse = new KeyResponse(keyRequest.RequestId, Benc, Bhmac);

            return(new SecretsAndKeyResponse(secrets, keyResponse));
        }
Пример #2
0
 public SecretsAndKeyResponse(Secrets secrets, KeyResponse keyResponse)
 {
     Secrets     = secrets;
     KeyResponse = keyResponse;
 }