Package de.christofreichardt.jca.shamir
Class ShamirsProtection
- java.lang.Object
-
- de.christofreichardt.jca.shamir.ShamirsProtection
-
- All Implemented Interfaces:
KeyStore.ProtectionParameter,Destroyable
public class ShamirsProtection extends Object implements KeyStore.ProtectionParameter, Destroyable
Protects aKeyStoreinstance and its entries by applying Shamirs Secret Sharing algorithm. Passwords have been splitted into several secret shares and have to been merged again to recover the original password. In order to create aShamirsProtectioninstance someone has to provide access to a certain subset of secret shares, e.g. paths to different slices (JSON files) of shares.- Author:
- Christof Reichardt
-
-
Constructor Summary
Constructors Constructor Description ShamirsProtection(jakarta.json.JsonArray slices)Creates a Shamir protection parameter by providing aJsonArraycomprising slices of secret shares.ShamirsProtection(Path[] paths)Creates a Shamir protection parameter by providing the paths to the different slices containing the shares.ShamirsProtection(Collection<Path> paths)Creates a Shamir protection parameter by providing the paths to the different slices containing the shares.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()char[]getPassword()Returns the recovered password, provided that the instance hasn't been destroyed.booleanisDestroyed()
-
-
-
Constructor Detail
-
ShamirsProtection
public ShamirsProtection(Path[] paths)
Creates a Shamir protection parameter by providing the paths to the different slices containing the shares.- Parameters:
paths- path array to the JSON files (slices) containing the shares
-
ShamirsProtection
public ShamirsProtection(Collection<Path> paths)
Creates a Shamir protection parameter by providing the paths to the different slices containing the shares.- Parameters:
paths- aCollectionofPaths pointing to the JSON files (slices) containing the shares
-
ShamirsProtection
public ShamirsProtection(jakarta.json.JsonArray slices)
Creates a Shamir protection parameter by providing aJsonArraycomprising slices of secret shares.- Parameters:
slices- aJsonArraycomprising slices of secret shares
-
-
Method Detail
-
getPassword
public char[] getPassword()
Returns the recovered password, provided that the instance hasn't been destroyed.- Returns:
- the recovered password
-
destroy
public void destroy() throws DestroyFailedException- Specified by:
destroyin interfaceDestroyable- Throws:
DestroyFailedException
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyedin interfaceDestroyable
-
-