Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Best way to remove password from archive

Mots-clés : 

3 sujets de 1 à 3 (sur un total de 3)
  • Auteur
    Messages
  • shaul
    Participant
    Post count: 3
    #44455 |

    Hi,

    What’s the best way to do the following:
    Input: Password protected archive.
    Output: Same archive without a password.

    Thanks,
    Shaul.

    Fawzi [Xceed]
    Membre
    Post count: 722

    Hi,

    For security reasons, you cannot remove the password of an encrypted archive and get an output of the same archive without a password. However, if you would like to encrypt an new file without a password, you could remove the DefaultEncryptionPassword property while creating the new archive.

    shaul
    Participant
    Post count: 3

    Thanks for the answer.
    I would like to clarify – I want to do the above while I have the password.

    What I did:

    var inZip = new ZipArchive(fileStream) { DefaultEncryptionPassword = password, DefaultDecryptionPassword = password };

    inZip.CopyFilesTo(outFolder, true, true);

    var localheader = new ZipItemLocalHeader() { EncryptionPassword = null };
    zipWriter.WriteItemLocalHeader(localHeader);
    zipWriter.WriteItemData(fileStream, buffer, 0, buffer.Length);

    Is this what you meant?

3 sujets de 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.