/** * For signing and verification. * * If the context property netdb.family.name is set, this can be used for signing, * else only for verification. */ public FamilyKeyCrypto(RouterContext context) throws GeneralSecurityException { _context = context; _log = _context.logManager().getLog(FamilyKeyCrypto.class); _fname = _context.getProperty(PROP_FAMILY_NAME); if (_fname != null) { if (_fname.contains("/") || _fname.contains("\\") || _fname.contains("..") || (new File(_fname)).isAbsolute() || _fname.length() <= 0) throw new GeneralSecurityException("Illegal family name: " + _fname); } _privkey = (_fname != null) ? initialize() : null; _pubkey = (_privkey != null) ? _privkey.toPublic() : null; _verified = new ConcurrentHashMap<Hash, String>(4); _negativeCache = new ConcurrentHashSet<Hash>(4); _ourFamily = (_privkey != null) ? new ConcurrentHashSet<Hash>(4) : Collections.<Hash>emptySet(); }