85 references to ZipEncryptionMethod
System.IO.Compression (64)
System\IO\Compression\ZipArchive.cs (2)
304
public ZipArchiveEntry CreateEntry(string entryName, ReadOnlySpan<char> password,
ZipEncryptionMethod
encryptionMethod)
327
public ZipArchiveEntry CreateEntry(string entryName, CompressionLevel compressionLevel, ReadOnlySpan<char> password,
ZipEncryptionMethod
encryptionMethod)
System\IO\Compression\ZipArchiveEntry.Async.cs (9)
215
if (Encryption ==
ZipEncryptionMethod
.Unknown)
296
if (Encryption ==
ZipEncryptionMethod
.Unknown)
488
if (Encryption ==
ZipEncryptionMethod
.Unknown)
720
if (Encryption ==
ZipEncryptionMethod
.ZipCrypto && _derivedZipCryptoKeyMaterial != null)
863
ZipEncryptionMethod
savedEncryption = Encryption;
871
if (savedEncryption is
ZipEncryptionMethod
.Aes128 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes256)
874
Encryption =
ZipEncryptionMethod
.None;
System\IO\Compression\ZipArchiveEntry.cs (53)
49
private
ZipEncryptionMethod
_encryptionMethod;
93
1 =>
ZipEncryptionMethod
.Aes128,
94
2 =>
ZipEncryptionMethod
.Aes192,
95
3 =>
ZipEncryptionMethod
.Aes256,
103
Encryption =
ZipEncryptionMethod
.Unknown;
108
Encryption =
ZipEncryptionMethod
.ZipCrypto;
229
/// <see cref="
ZipEncryptionMethod
.None"/> if the entry is not encrypted;
230
/// <see cref="
ZipEncryptionMethod
.Unknown"/> if the entry uses an unsupported encryption method;
231
/// otherwise, the specific encryption method (e.g., <see cref="
ZipEncryptionMethod
.ZipCrypto"/>,
232
/// <see cref="
ZipEncryptionMethod
.Aes128"/>, <see cref="
ZipEncryptionMethod
.Aes192"/>,
233
/// or <see cref="
ZipEncryptionMethod
.Aes256"/>).
235
public
ZipEncryptionMethod
EncryptionMethod => _encryptionMethod;
1044
private bool UseAesEncryption => Encryption is
ZipEncryptionMethod
.Aes128 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes256;
1048
private static int GetAesKeySizeBits(
ZipEncryptionMethod
encryption)
1054
ZipEncryptionMethod
.Aes128 => 128,
1055
ZipEncryptionMethod
.Aes192 => 192,
1056
ZipEncryptionMethod
.Aes256 => 256,
1067
if (Encryption ==
ZipEncryptionMethod
.Unknown)
1194
ZipEncryptionMethod
encryptionMethod = Encryption;
1200
if (encryptionMethod ==
ZipEncryptionMethod
.ZipCrypto)
1216
else if (encryptionMethod is
ZipEncryptionMethod
.Aes256 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes128)
1230
bool isAesEncryption = encryptionMethod is
ZipEncryptionMethod
.Aes256 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes128;
1242
streamForPosition: encryptionMethod !=
ZipEncryptionMethod
.None ? _archive.ArchiveStream : null);
1256
if (Encryption ==
ZipEncryptionMethod
.Unknown)
1325
Encryption =
ZipEncryptionMethod
.ZipCrypto;
1339
/// Called by <see cref="ZipArchive.CreateEntry(string, ReadOnlySpan{char},
ZipEncryptionMethod
)"/>.
1341
internal void PrepareEncryption(ReadOnlySpan<char> password,
ZipEncryptionMethod
encryptionMethod)
1348
if (encryptionMethod ==
ZipEncryptionMethod
.ZipCrypto)
1353
else if (encryptionMethod is
ZipEncryptionMethod
.Aes128 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes256)
1377
ZipEncryptionMethod
.Aes128 => (byte)1,
1378
ZipEncryptionMethod
.Aes192 => (byte)2,
1379
ZipEncryptionMethod
.Aes256 => (byte)3,
1549
internal
ZipEncryptionMethod
Encryption { get => _encryptionMethod; private set => _encryptionMethod = value; }
1580
if (Encryption ==
ZipEncryptionMethod
.ZipCrypto)
1689
else if (Encryption !=
ZipEncryptionMethod
.ZipCrypto)
1771
if (Encryption ==
ZipEncryptionMethod
.ZipCrypto && _derivedZipCryptoKeyMaterial is not null)
1874
ZipEncryptionMethod
savedEncryption = Encryption;
1882
if (savedEncryption is
ZipEncryptionMethod
.Aes128 or
ZipEncryptionMethod
.Aes192 or
ZipEncryptionMethod
.Aes256)
1885
Encryption =
ZipEncryptionMethod
.None;
2193
private readonly
ZipEncryptionMethod
_encryption;
2198
public DirectToArchiveWriterStream(CheckSumAndSizeWriteStream crcSizeStream, ZipArchiveEntry entry,
ZipEncryptionMethod
encryptionMethod =
ZipEncryptionMethod
.None, Stream? encryptionStream = null)
System.IO.Compression.ZipFile (21)
System\IO\Compression\ZipFile.Create.Async.cs (4)
445
if (options.EncryptionMethod !=
ZipEncryptionMethod
.None && options.Password.IsEmpty)
472
if (options.EncryptionMethod !=
ZipEncryptionMethod
.None && options.Password.IsEmpty)
522
ReadOnlyMemory<char> password = default,
ZipEncryptionMethod
encryptionMethod =
ZipEncryptionMethod
.None, CancellationToken cancellationToken = default)
System\IO\Compression\ZipFile.Create.cs (4)
414
if (options.EncryptionMethod !=
ZipEncryptionMethod
.None && options.Password.IsEmpty)
436
if (options.EncryptionMethod !=
ZipEncryptionMethod
.None && options.Password.IsEmpty)
472
ReadOnlySpan<char> password = default,
ZipEncryptionMethod
encryptionMethod =
ZipEncryptionMethod
.None)
System\IO\Compression\ZipFileCreationOptions.cs (1)
21
public
ZipEncryptionMethod
EncryptionMethod { get; set; }
System\IO\Compression\ZipFileExtensions.ZipArchive.Create.Async.cs (4)
75
string sourceFileName, string entryName, ReadOnlyMemory<char> password,
ZipEncryptionMethod
encryption, CancellationToken cancellationToken = default) =>
139
string sourceFileName, string entryName, CompressionLevel compressionLevel, ReadOnlyMemory<char> password,
ZipEncryptionMethod
encryption, CancellationToken cancellationToken = default) =>
143
CompressionLevel? compressionLevel, ReadOnlyMemory<char> password = default,
ZipEncryptionMethod
encryption =
ZipEncryptionMethod
.None, CancellationToken cancellationToken = default)
System\IO\Compression\ZipFileExtensions.ZipArchive.Create.cs (8)
91
public static ZipArchiveEntry CreateEntryFromFile(this ZipArchive destination, string sourceFileName, string entryName, ReadOnlySpan<char> password,
ZipEncryptionMethod
encryption) =>
126
ReadOnlySpan<char> password,
ZipEncryptionMethod
encryption) =>
131
ReadOnlySpan<char> password = default,
ZipEncryptionMethod
encryption =
ZipEncryptionMethod
.None)
147
private static (FileStream, ZipArchiveEntry) InitializeDoCreateEntryFromFile(ZipArchive destination, string sourceFileName, string entryName, CompressionLevel? compressionLevel, bool useAsync, ReadOnlySpan<char> password = default,
ZipEncryptionMethod
encryption =
ZipEncryptionMethod
.None)
160
if (encryption !=
ZipEncryptionMethod
.None && password.IsEmpty)
167
if (encryption !=
ZipEncryptionMethod
.None)