Package jenkins.security
Class ConfidentialStore
java.lang.Object
jenkins.security.ConfidentialStore
- Direct Known Subclasses:
DefaultConfidentialStore
The actual storage for the data held by
ConfidentialKey
s, and the holder
of the master secret.
This class is only relevant for the implementers of ConfidentialKey
s.
Most plugin code should interact with ConfidentialKey
s.
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 Extension
s 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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfidentialStore
get()
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 void
store
(ConfidentialKey key, byte[] payload) Persists the payload ofConfidentialKey
to 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 ofConfidentialKey
to 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
.
-