コード例 #1
0
 /// <summary>
 /// Generates the key.
 /// </summary>
 /// <param name="size">The size.</param>
 protected override void GenerateKey(int size, KeyczarConfig config)
 {
     AesKeyBytes = new byte[size / 8];
     Secure.Random.NextBytes(AesKeyBytes);
     HmacKey            = (HmacSha2Key)Generate(UnofficialKeyType.HmacSha2, size);
     HmacKey.HashLength = size / 8;  //Truncate hash length to match JWE
     //https://tools.ietf.org/html/rfc7518#page-23
 }
コード例 #2
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     Mode        = null;
     AesKeyBytes = AesKeyBytes.Clear();
     HmacKey     = HmacKey.SafeDispose();
 }