public final class Cryptors extends Object
Constructor | Description |
---|---|
Cryptors() |
Modifier and Type | Method | Description |
---|---|---|
static byte[] |
changePassphrase(CryptorProvider cryptoProvider,
byte[] masterkey,
byte[] pepper,
CharSequence oldPassphrase,
CharSequence newPassphrase) |
Reencrypts a masterkey with a new passphrase.
|
static byte[] |
changePassphrase(CryptorProvider cryptoProvider,
byte[] masterkey,
CharSequence oldPassphrase,
CharSequence newPassphrase) |
Reencrypts a masterkey with a new passphrase.
|
static long |
ciphertextSize(long cleartextSize,
Cryptor cryptor) |
Calculates the size of the ciphertext resulting from the given cleartext encrypted with the given cryptor.
|
static long |
cleartextSize(long ciphertextSize,
Cryptor cryptor) |
Calculates the size of the cleartext resulting from the given ciphertext decrypted with the given cryptor.
|
static CryptorProvider |
version1(SecureRandom seeder) |
public static CryptorProvider version1(SecureRandom seeder)
seeder
- A native (if possible) SecureRandom used to seed internal CSPRNGs.public static long cleartextSize(long ciphertextSize, Cryptor cryptor)
ciphertextSize
- Length of encrypted payload. Not including the length of the header
.cryptor
- The cryptor which defines the cleartext/ciphertext ratiociphertextSize
-sized ciphertext decrypted with cryptor
.public static long ciphertextSize(long cleartextSize, Cryptor cryptor)
cleartextSize
- Length of a unencrypted payload.cryptor
- The cryptor which defines the cleartext/ciphertext ratiocleartextSize
-sized cleartext encrypted with cryptor
.
Not including the length of the header
.public static byte[] changePassphrase(CryptorProvider cryptoProvider, byte[] masterkey, CharSequence oldPassphrase, CharSequence newPassphrase) throws InvalidPassphraseException
cryptoProvider
- A suitable CryptorProvider instance, i.e. same version as the original masterkey has been created with.masterkey
- The original JSON representation of the masterkeyoldPassphrase
- The old passphrasenewPassphrase
- The new passphrasenewPassphrase
InvalidPassphraseException
- If the wrong oldPassphrase
has been supplied for the masterkey
changePassphrase(CryptorProvider, byte[], byte[], CharSequence, CharSequence)
public static byte[] changePassphrase(CryptorProvider cryptoProvider, byte[] masterkey, byte[] pepper, CharSequence oldPassphrase, CharSequence newPassphrase) throws InvalidPassphraseException
cryptoProvider
- A suitable CryptorProvider instance, i.e. same version as the original masterkey has been created with.masterkey
- The original JSON representation of the masterkeypepper
- An application-specific pepper added to the salt during key-derivation (if applicable)oldPassphrase
- The old passphrasenewPassphrase
- The new passphrasenewPassphrase
InvalidPassphraseException
- If the wrong oldPassphrase
has been supplied for the masterkey
Copyright © 2018. All rights reserved.