Package jenkins.security
Class ConfidentialStore
java.lang.Object
jenkins.security.ConfidentialStore
- Direct Known Subclasses:
DefaultConfidentialStore
The actual storage for the data held by
ConfidentialKeys, and the holder
of the master secret.
This class is only relevant for the implementers of ConfidentialKeys.
Most plugin code should interact with ConfidentialKeys.
OEM distributions of Jenkins can provide a custom ConfidentialStore implementation
by writing a subclass, mark it with MetaInfServices annotation, package it as a Jenkins module,
and bundling it with the war file. This doesn't use Extension because some plugins
have been found to use Secret before we get to InitMilestone.PLUGINS_PREPARED, and
therefore Extensions aren't loaded yet. (Similarly, it's conceivable that some future
core code might need this early on during the boot sequence.)
- Since:
- 1.498
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfidentialStoreget()Retrieves the currently active singleton instance ofConfidentialStore.protected abstract byte[]load(ConfidentialKey key) Reverse operation ofstore(ConfidentialKey, byte[])abstract byte[]randomBytes(int size) Works likeSecureRandom.nextBytes(byte[]).protected abstract voidstore(ConfidentialKey key, byte[] payload) Persists the payload ofConfidentialKeyto a persisted storage (such as disk.) The expectation is that the persisted form is secure.
-
Constructor Details
-
ConfidentialStore
public ConfidentialStore()
-
-
Method Details
-
store
Persists the payload ofConfidentialKeyto a persisted storage (such as disk.) The expectation is that the persisted form is secure.- Throws:
IOException
-
load
Reverse operation ofstore(ConfidentialKey, byte[])- Returns:
- null the data has not been previously persisted, or if the data was tampered.
- Throws:
IOException
-
randomBytes
public abstract byte[] randomBytes(int size) Works likeSecureRandom.nextBytes(byte[]). This enables implementations to consult other entropy sources, if it's available. -
get
Retrieves the currently active singleton instance ofConfidentialStore.
-