private ICryptoTransform NewEncryptor(byte[] rgbKey, CipherMode mode, byte[] rgbIV, int feedbackSize, RijndaelManagedTransformMode encryptMode) { // Build the key if one does not already exist if (rgbKey == null) { rgbKey = Utils.GenerateRandom(KeySizeValue / 8); } // If not ECB mode, make sure we have an IV. In CoreCLR we do not support ECB, so we must have // an IV in all cases. #if !FEATURE_CRYPTO if (mode != CipherMode.ECB) { #endif // !FEATURE_CRYPTO if (rgbIV == null) { rgbIV = Utils.GenerateRandom(BlockSizeValue / 8); } #if !FEATURE_CRYPTO } #endif // !FEATURE_CRYPTO // Create the encryptor/decryptor object return(new RijndaelManagedTransform(rgbKey, mode, rgbIV, BlockSizeValue, feedbackSize, PaddingValue, encryptMode)); }
private ICryptoTransform NewEncryptor(byte[] rgbKey, CipherMode mode, byte[] rgbIV, int feedbackSize, RijndaelManagedTransformMode encryptMode) { if (rgbKey == null) { rgbKey = Utils.GenerateRandom(base.KeySizeValue / 8); } if (rgbIV == null) { rgbIV = Utils.GenerateRandom(base.BlockSizeValue / 8); } return(new RijndaelManagedTransform(rgbKey, mode, rgbIV, base.BlockSizeValue, feedbackSize, base.PaddingValue, encryptMode)); }
public override void GenerateIV() { IVValue = Utils.GenerateRandom(BlockSizeValue / 8); }
public override void GenerateKey() { KeyValue = Utils.GenerateRandom(KeySizeValue / 8); }
public HMACSHA512() : this(Utils.GenerateRandom(0x80)) { }
/// <summary>使用随机生成的密钥初始化 <see cref="T:System.Security.Cryptography.HMACSHA1" /> 类的新实例。</summary> public HMACSHA1() : this(Utils.GenerateRandom(64)) { }
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA384" /> class by using a randomly generated key.</summary> // Token: 0x060021C4 RID: 8644 RVA: 0x000778DA File Offset: 0x00075ADA public HMACSHA384() : this(Utils.GenerateRandom(128)) { }
/// <summary>使用随机生成的密钥初始化 <see cref="T:System.Security.Cryptography.HMACMD5" /> 类的新实例。</summary> public HMACMD5() : this(Utils.GenerateRandom(64)) { }
/// <summary>用随机生成的 64 字节密钥初始化 <see cref="T:System.Security.Cryptography.HMACRIPEMD160" /> 类的新实例。</summary> public HMACRIPEMD160() : this(Utils.GenerateRandom(64)) { }
public HMACSHA256() : this(Utils.GenerateRandom(0x40)) { }