Question Compression via IOnic.Zip.dll

Plus d'informations
il y a 13 ans 9 mois #12003 par Matthew BETTON
Bonjour,

Je continue d'avancer sur un module PowerShell qui utilise une DLL du dotnetzip .

J'ai un petit souci concernant la compression avec mot de passe.
e
Pour faire simple, ce code :

[code:1]$dir = \"C:\Windows\System32\WindowsPowerShell\v1.0\Modules\IonicZip\"
[System.Reflection.Assmbly]::LoadFrom(\"$dir\Ionic.Zip.dll\"«»)
$objZip = new-object Ionic.Zip.ZipFile
$objZip.Password = \"password\"
$objzip.AddDirectory(\"D:\tmp\test\"«»)
$objZip.Save(\"D:\tmp\test.zip\"«»)
$objZip.Dispose()
[/code:1]

fonctionne sur une machine... et pas sur une autre.

La compression est OK, mais sur l'un des postes, les données de l'archive ne sont pas protégées par mot de passe.

Le code étant simplifié, je ne comprends pas d'où cela peut venir. Un paramétrage sur le poste ? Un bug ?

Quelqu'un a t'il déjà rencontré ce problème ?


@ +

Matthew

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 13 ans 9 mois #12004 par Matthew BETTON
... je me répond à moi même.

When writing a zip archive, keep this in mind: though the password is set on the ZipFile object, according to the Zip spec, the \"directory\" of the archive - in other words the list of entries or files contained in the archive - is not encrypted with the password, or protected in any way. If you set the Password property, the password actually applies to individual entries that are added to the archive, subsequent to the setting of this property. The list of filenames in the archive that is eventually created will appear in clear text, but the contents of the individual files are encrypted. This is how Zip encryption works.


Si le fichier fait 0 octet : pas de cryptage, puisqu'il est vide :P

@ +

Matthew

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.044 secondes
Propulsé par Kunena