111 lines
2.5 KiB
C#
111 lines
2.5 KiB
C#
using System;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace ICSharpCode.SharpZipLib.Encryption
|
|
{
|
|
// Token: 0x02000024 RID: 36
|
|
public sealed class PkzipClassicManaged : PkzipClassic
|
|
{
|
|
// Token: 0x1700002B RID: 43
|
|
// (get) Token: 0x060000F7 RID: 247 RVA: 0x00007E46 File Offset: 0x00006E46
|
|
// (set) Token: 0x060000F8 RID: 248 RVA: 0x00007E49 File Offset: 0x00006E49
|
|
public override int BlockSize
|
|
{
|
|
get
|
|
{
|
|
return 8;
|
|
}
|
|
set
|
|
{
|
|
if (value != 8)
|
|
{
|
|
throw new CryptographicException("Block size is invalid");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700002C RID: 44
|
|
// (get) Token: 0x060000F9 RID: 249 RVA: 0x00007E5C File Offset: 0x00006E5C
|
|
public override KeySizes[] LegalKeySizes
|
|
{
|
|
get
|
|
{
|
|
return new KeySizes[]
|
|
{
|
|
new KeySizes(96, 96, 0)
|
|
};
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000FA RID: 250 RVA: 0x00007E7E File Offset: 0x00006E7E
|
|
public override void GenerateIV()
|
|
{
|
|
}
|
|
|
|
// Token: 0x1700002D RID: 45
|
|
// (get) Token: 0x060000FB RID: 251 RVA: 0x00007E80 File Offset: 0x00006E80
|
|
public override KeySizes[] LegalBlockSizes
|
|
{
|
|
get
|
|
{
|
|
return new KeySizes[]
|
|
{
|
|
new KeySizes(8, 8, 0)
|
|
};
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700002E RID: 46
|
|
// (get) Token: 0x060000FC RID: 252 RVA: 0x00007EA0 File Offset: 0x00006EA0
|
|
// (set) Token: 0x060000FD RID: 253 RVA: 0x00007EC0 File Offset: 0x00006EC0
|
|
public override byte[] Key
|
|
{
|
|
get
|
|
{
|
|
if (this.key_ == null)
|
|
{
|
|
this.GenerateKey();
|
|
}
|
|
return (byte[])this.key_.Clone();
|
|
}
|
|
set
|
|
{
|
|
if (value == null)
|
|
{
|
|
throw new ArgumentNullException("value");
|
|
}
|
|
if (value.Length != 12)
|
|
{
|
|
throw new CryptographicException("Key size is illegal");
|
|
}
|
|
this.key_ = (byte[])value.Clone();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000FE RID: 254 RVA: 0x00007EF4 File Offset: 0x00006EF4
|
|
public override void GenerateKey()
|
|
{
|
|
this.key_ = new byte[12];
|
|
Random random = new Random();
|
|
random.NextBytes(this.key_);
|
|
}
|
|
|
|
// Token: 0x060000FF RID: 255 RVA: 0x00007F20 File Offset: 0x00006F20
|
|
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
this.key_ = rgbKey;
|
|
return new PkzipClassicEncryptCryptoTransform(this.Key);
|
|
}
|
|
|
|
// Token: 0x06000100 RID: 256 RVA: 0x00007F34 File Offset: 0x00006F34
|
|
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
|
|
{
|
|
this.key_ = rgbKey;
|
|
return new PkzipClassicDecryptCryptoTransform(this.Key);
|
|
}
|
|
|
|
// Token: 0x0400008A RID: 138
|
|
private byte[] key_;
|
|
}
|
|
}
|