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 -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static JSONCodec(package private) Settings.Dataprivate booleanprivate booleanprivate char[]private PrivateKeyprivate PublicKeyprivate final File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheck()voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()voidgenerate()voidgenerate(char[] password) getEmail()getName()byte[]Return an encoded private RSA key.byte[]Return an encoded public RSA key.private voidinitKeys()booleanisDirty()booleanisEmpty()keySet()booleanload()booleanload(char[] password) voidvoidsave()voidsave(char[] password) voidvoidsetKeyPair(byte[] id, byte[] secret) voidbyte[]sign(byte[] con) Sign a byte arrayintsize()toString()values()booleanverify(byte[] con) Verify a signed byte arrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
codec
-
where
-
publicKey
-
privateKey
-
loaded
private boolean loaded -
dirty
private boolean dirty -
data
Settings.Data data -
password
private char[] password
-
-
Constructor Details
-
Settings
public Settings() -
Settings
-
-
Method Details
-
load
public boolean load() -
load
public boolean load(char[] password) -
check
private void check() -
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
-
initKeys
- Throws:
Exception
-
sign
Sign a byte array- Throws:
Exception
-
verify
Verify a signed byte array- Throws:
Exception
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,String>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,String>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
isDirty
public boolean isDirty() -
toString
-