public class UserKeysStorage extends Object
| Constructor and Description |
|---|
UserKeysStorage() |
| Modifier and Type | Method and Description |
|---|---|
static UserKeysForSupplier |
fromInterMapForPublisher(TreeMap<String,String> interMap,
boolean doSelfcheck) |
static UserKeysForConsumer |
fromInterMapForUser(TreeMap<String,String> interMap,
boolean doSelfcheck) |
static Cipher |
getConsumerKeyDecryptionCipher(Key key,
byte[] iv)
Decryption cipher for consumer keyfiles.
|
static Cipher |
getConsumerKeyEncryptionCipher(Key key,
byte[] iv)
Encryption cipher for consumer keyfiles.
|
static String |
getSelfcheckSum(String encodedAsymmetric,
String encodedSecret)
Get a selfcheck sum derived from two Strings.
|
static Key |
passwordTo16ByteKey(String password,
byte[] untrustedSalt)
Transforms the user password into a key for keyfile decryption.
|
static UserKeysForConsumer |
readUserKeysForConsumer(File inputFile,
String password,
boolean doSelfcheck) |
static UserKeysForSupplier |
readUserKeysForPublisher(File inputFile,
boolean doSelfcheck) |
static TreeMap<String,String> |
toInterMap(UserKeysForConsumer userKeysForConsumer) |
static TreeMap<String,String> |
toInterMap(UserKeysForSupplier userKeysForSupplier) |
static void |
writeUserKeys(UserKeysForConsumer userKeysForConsumer,
String password,
File outputFile)
Writes the input object to a custom file
|
static void |
writeUserKeys(UserKeysForSupplier userKeysForSupplier,
File outputFile)
Writes the input object to a custom file.
|
public static Cipher getConsumerKeyEncryptionCipher(Key key, byte[] iv) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, InvalidKeyException
key - the used cryptographic keyiv - the used cryptographic (unique) ivNoSuchPaddingException - throws on failureNoSuchAlgorithmException - throws on failureNoSuchProviderException - throws on failureInvalidAlgorithmParameterException - throws on failureInvalidKeyException - throws on failurepublic static Cipher getConsumerKeyDecryptionCipher(Key key, byte[] iv) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, InvalidKeyException
key - the used cryptographic keyiv - the used cryptographic (unique) ivNoSuchPaddingException - throws on failureNoSuchAlgorithmException - throws on failureNoSuchProviderException - throws on failureInvalidAlgorithmParameterException - throws on failureInvalidKeyException - throws on failurepublic static Key passwordTo16ByteKey(String password, byte[] untrustedSalt)
password - the password to be turned into a secret keyuntrustedSalt - salt (may be untrusted) to use in turning the password into a secret keypublic static String getSelfcheckSum(String encodedAsymmetric, String encodedSecret)
encodedAsymmetric - the string (as it appears in the keyfile)encodedSecret - an encoded secret (as it appears in the keyfile)public static void writeUserKeys(UserKeysForSupplier userKeysForSupplier, File outputFile) throws IOException
userKeysForSupplier - what will be writtenoutputFile - where to write the fileIOException - throws on failure to write to the filepublic static void writeUserKeys(UserKeysForConsumer userKeysForConsumer, String password, File outputFile) throws IOException
userKeysForConsumer - what will be writtenpassword - password to encrypt the consumer keyfile withoutputFile - where to write the fileIOException - throws on failure to write to the filepublic static UserKeysForSupplier readUserKeysForPublisher(File inputFile, boolean doSelfcheck) throws IOException, SelfcheckFailedException
IOExceptionSelfcheckFailedExceptionpublic static UserKeysForConsumer readUserKeysForConsumer(File inputFile, String password, boolean doSelfcheck) throws IOException, SelfcheckFailedException
IOExceptionSelfcheckFailedExceptionpublic static UserKeysForConsumer fromInterMapForUser(TreeMap<String,String> interMap, boolean doSelfcheck) throws IOException, SelfcheckFailedException
IOExceptionSelfcheckFailedExceptionpublic static UserKeysForSupplier fromInterMapForPublisher(TreeMap<String,String> interMap, boolean doSelfcheck) throws IOException, SelfcheckFailedException
IOExceptionSelfcheckFailedExceptionpublic static TreeMap<String,String> toInterMap(UserKeysForSupplier userKeysForSupplier) throws IOException
IOExceptionpublic static TreeMap<String,String> toInterMap(UserKeysForConsumer userKeysForConsumer) throws IOException
IOExceptionLicensed under the Apache License 2.0 - Copyright © {inceptionYear} – 2024 the original author or authors.