|
TrueZIP Samples 7.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.sample.zip.raes.KeyManagement
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class KeyManagement
Provides static utility methods to set passwords for RAES encrypted ZIP files programmatically. Use whatever approach fits your needs best when you want to set the password programmatically instead of prompting the user for a key by means of the default Swing or Console based user interfaces.
| Nested Class Summary | |
|---|---|
private static class |
KeyManagement.SimpleKeyManagerService
|
private static class |
KeyManagement.SimpleKeyProvider
|
private static class |
KeyManagement.SimpleKeyProviderFactory
|
private static class |
KeyManagement.SimpleView
|
| Constructor Summary | |
|---|---|
private |
KeyManagement()
You cannot instantiate this class. |
| Method Summary | |
|---|---|
static void |
setAllPasswords1(char[] password)
Sets the password for all RAES encrypted ZIP files. |
static void |
setAllPasswords2(char[] password)
Sets the password for all RAES encrypted ZIP files. |
static void |
setPassword(TFile file,
char[] password)
Sets the password for an individual RAES encrypted ZIP file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private KeyManagement()
| Method Detail |
|---|
public static void setPassword(TFile file,
char[] password)
KeyManager for
AesCipherParameters and the default KeyProvider for the
given file in order to set the given password.
As another side effect, the key strength of the
AesCipherParameters is set to the maximum 256 bits.
This method makes a protective copy of the given password char array. It's highly recommended to overwrite this array with any non-password data after calling this method.
file - the TZP archive file to set the password for.password - the password char array to be copied for subsequent use.public static void setAllPasswords1(char[] password)
TFile.setDefaultArchiveDetector(de.schlichtherle.truezip.file.TArchiveDetector).
This will affect only subsequently created TFile objects!
This method decorates TArchiveDetector.ALL with a
custom archive driver for the canonical archive file suffixes
"tzp|zip.rae|zip.raes" and installs the result as the
default archive detector using TFile.setDefaultArchiveDetector(de.schlichtherle.truezip.file.TArchiveDetector).
The custom archive driver uses a custom KeyManagement.SimpleView implementation for
its PromptingKeyManagerService.
The key strength for all archive files
AesCipherParameters is set to the maximum 256 bits.
This method makes a protective copy of the given password char array. It's highly recommended to overwrite this array with any non-password data after calling this method.
password - the password char array to be copied for subsequent use.public static void setAllPasswords2(char[] password)
TFile.setDefaultArchiveDetector(de.schlichtherle.truezip.file.TArchiveDetector).
This will affect only subsequently created TFile objects!
This method decorates TArchiveDetector.ALL with a
custom archive driver for the canonical archive file suffixes
"tzp|zip.rae|zip.raes" and installs the result as the
default archive detector using TFile.setDefaultArchiveDetector(de.schlichtherle.truezip.file.TArchiveDetector).
The custom archive driver uses a custom implementation of a
KeyManager which requires considerably more code than the
approach used in setAllPasswords1(char[]).
As another side effect, the key strength of the
AesCipherParameters is set to the maximum 256 bits.
This method makes a protective copy of the given password char array. It's highly recommended to overwrite this array with any non-password data after calling this method.
password - the password char array to be copied for subsequent use.
|
TrueZIP Samples 7.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||