Exemple #1
0
        public async Task Add(Guid viud, BigInteger cvki, AesKey cvkiAuth, C25519Key cvkPub, Guid keyId, byte[] signature)
        {
            var payload = JsonSerializer.Serialize(new[] {
                cvkPub.ToByteArray(),
                cvki.ToByteArray(true, true),
                cvkiAuth.ToByteArray(),
                signature,
            });

            var body     = new StringContent(payload, Encoding.UTF8, "application/json");
            var response = await _client.PutAsync($"api/cvk/{viud}/{keyId}", body);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException(response.ToString());
            }
        }
 public void Set(C25519Key key)
 {
     Key   = key;
     KeyId = new Guid(Utils.Hash(key.ToByteArray()).Take(16).ToArray());
 }