Package net.i2p.router.crypto
Class FamilyKeyCrypto
java.lang.Object
net.i2p.router.crypto.FamilyKeyCrypto
public class FamilyKeyCrypto extends Object
Utilities for creating, storing, retrieving the signing keys for
the netdb family feature
- Since:
- 0.9.24
-
Field Summary
Fields Modifier and Type Field Description static String
CERT_SUFFIX
static String
CN_SUFFIX
static String
CRL_SUFFIX
static String
KEYSTORE_PREFIX
static String
KEYSTORE_SUFFIX
static String
OPT_KEY
static String
OPT_NAME
static String
OPT_SIG
static String
PROP_FAMILY_NAME
static String
PROP_KEY_PASSWORD
static String
PROP_KEYSTORE_PASSWORD
-
Constructor Summary
Constructors Constructor Description FamilyKeyCrypto(RouterContext context)
For signing and verification. -
Method Summary
Modifier and Type Method Description Set<Hash>
getOurFamily()
Get verified members of our family.String
getOurFamilyName()
Get our family name.boolean
hasFamily()
Do we have a valid family?static void
main(String[] args)
void
shutdown()
Clears the cachesMap<String,String>
sign(String family, Hash h)
Caller must add family to RI also.boolean
verify(RouterInfo ri)
Verify the family signature in a RouterInfo.boolean
verifyOurFamily(RouterInfo ri)
Verify the family in a RouterInfo matches ours and the signature is good.
-
Field Details
-
PROP_KEYSTORE_PASSWORD
- See Also:
- Constant Field Values
-
PROP_FAMILY_NAME
- See Also:
- Constant Field Values
-
PROP_KEY_PASSWORD
- See Also:
- Constant Field Values
-
CERT_SUFFIX
- See Also:
- Constant Field Values
-
CRL_SUFFIX
- See Also:
- Constant Field Values
-
KEYSTORE_PREFIX
- See Also:
- Constant Field Values
-
KEYSTORE_SUFFIX
- See Also:
- Constant Field Values
-
CN_SUFFIX
- See Also:
- Constant Field Values
-
OPT_NAME
- See Also:
- Constant Field Values
-
OPT_SIG
- See Also:
- Constant Field Values
-
OPT_KEY
- See Also:
- Constant Field Values
-
-
Constructor Details
-
FamilyKeyCrypto
For signing and verification. If the context property netdb.family.name is set, this can be used for signing, else only for verification.- Throws:
GeneralSecurityException
-
-
Method Details
-
shutdown
public void shutdown()Clears the caches -
sign
Caller must add family to RI also. throws on all errors- Parameters:
family
- non-null, must match that we were initialized with or will throw GSEh
- non-null- Returns:
- non-null options to be added to the RI
- Throws:
GeneralSecurityException
- on null hash, null or changed family, or signing error
-
hasFamily
public boolean hasFamily()Do we have a valid family?- Since:
- 0.9.28
-
getOurFamily
Get verified members of our family. Will not contain ourselves.- Returns:
- non-null, not a copy, do not modify
- Since:
- 0.9.28
-
getOurFamilyName
Get our family name.- Returns:
- name or null
- Since:
- 0.9.28
-
verify
Verify the family signature in a RouterInfo.- Returns:
- true if good sig or if no family specified at all
-
verifyOurFamily
Verify the family in a RouterInfo matches ours and the signature is good. Returns false if we don't have a family and sig, or they don't. Returns false for ourselves.- Returns:
- true if family matches with good sig
- Since:
- 0.9.28
-
main
- Since:
- 0.9.36
-