Package aQute.lib.settings
Class Settings
java.lang.Object
aQute.lib.settings.Settings
Maintains persistent settings for bnd (or other apps). The default is
~/.bnd/settings.json). The settings are normal string properties but it
specially maintains a public/private key pair and it provides a method to
sign a byte array with this pair.
Why not keystore and preferences? Well, keystore is hard to use (you can only
store a private key when you have a certificate, but you cannot create a
certificate without using com.sun classes) and preferences are not editable.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
void
generate()
void
generate
(char[] password) getEmail()
getName()
byte[]
Return an encoded private RSA key.byte[]
Return an encoded public RSA key.boolean
isDirty()
boolean
isEmpty()
keySet()
boolean
load()
boolean
load
(char[] password) void
void
save()
void
save
(char[] password) void
void
setKeyPair
(byte[] id, byte[] secret) void
byte[]
sign
(byte[] con) Sign a byte arrayint
size()
toString()
values()
boolean
verify
(byte[] con) Verify a signed byte arrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
Settings
public Settings() -
Settings
-
-
Method Details
-
load
public boolean load() -
load
public boolean load(char[] password) -
save
public void save() -
save
public void save(char[] password) -
generate
- Throws:
Exception
-
generate
- Throws:
Exception
-
getEmail
-
setEmail
-
setKeyPair
- Throws:
Exception
-
setName
-
getName
-
getPublicKey
Return an encoded public RSA key. this key can be decoded with an X509EncodedKeySpec- Returns:
- an encoded public key.
- Throws:
Exception
-
getPrivateKey
Return an encoded private RSA key. this key can be decoded with an PKCS8EncodedKeySpec- Returns:
- an encoded private key.
- Throws:
Exception
-
sign
Sign a byte array- Throws:
Exception
-
verify
Verify a signed byte array- Throws:
Exception
-
clear
public void clear() -
containsKey
- Specified by:
containsKey
in interfaceMap<String,
String>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
String>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
isDirty
public boolean isDirty() -
toString
-