Class KeyStoreManager
java.lang.Object
net.vincent.communidirect.common.crypto.KeyStoreManager
Loads the local identity keys and all trusted peer public keys as described
in
~/.communidirect/keys.toml.
On first run, if keys.toml is absent, delegates to
KeyGenerator.generate() to create a fresh identity before loading.
Peer public-key discovery uses a *.pub glob over the configured
peers.public_keys_dir. Each file must contain either 32 raw Ed25519
bytes or the full 44-byte SubjectPublicKeyInfo DER encoding; both forms are
accepted transparently. The map key is the filename stripped of its
.pub extension (e.g. "vincent" for vincent.pub).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable view of all loaded peer public keys, keyed by alias.byte[]Returns the server's own 32-byte raw Ed25519 public key, loaded fromkeys/self.pub.byte[]getOwnPublicKeyRaw(String alias) getPeerKey(String alias) Returns the public key for a peer alias, ornullif unknown.Returns the local Ed25519 private key.getPrivateKey(String alias) voidload()Loads keys from disk.booleansetActivePrivateKey(String alias)
-
Constructor Details
-
KeyStoreManager
public KeyStoreManager()
-
-
Method Details
-
load
-
getPrivateKey
Returns the local Ed25519 private key.- Returns:
- this system's Ed25519 private key for signing outbound messages
-
getPrivateKey
-
getOwnPublicKeyRaw
public byte[] getOwnPublicKeyRaw()Returns the server's own 32-byte raw Ed25519 public key, loaded fromkeys/self.pub. Required byCdirMessage.decode(java.io.InputStream, java.security.PrivateKey, byte[]).- Returns:
- the local 32-byte raw Ed25519 public key
-
getOwnPublicKeyRaw
-
getActivePrivateKeyAlias
-
setActivePrivateKey
-
getAllPrivateKeys
-
getAllPrivateKeyAliases
-
getPeerKey
-
getAllPeerKeys
-