Exemplo n.º 1
0
 static {
   for (int i = 0; i < DSA_ONLY_HASHES.length; i++) {
     String s = DSA_ONLY_HASHES[i];
     Hash h = ConvertToHash.getHash(s);
     if (h != null) _dsaOnly.add(h);
     else System.out.println("Bad hash " + s);
   }
 }
Exemplo n.º 2
0
 /**
  * Update the global user DSA-only list. This does not affect the hardcoded DSA_ONLY_HASHES list
  * above, the user can only add, not remove.
  *
  * @since 0.9.21
  */
 private void updateUserDsaList() {
   String hashes = _context.getProperty(PROP_DSALIST, "");
   if (!_userDsaList.equals(hashes)) {
     // rebuild _userDsaOnly when property changes
     synchronized (_userDsaOnly) {
       if (hashes.length() > 0) {
         Set<Hash> newSet = new HashSet<Hash>();
         StringTokenizer tok = new StringTokenizer(hashes, ",; ");
         while (tok.hasMoreTokens()) {
           String hashstr = tok.nextToken();
           Hash hh = ConvertToHash.getHash(hashstr);
           if (hh != null) newSet.add(hh);
           else _log.error("Bad " + PROP_DSALIST + " entry: " + hashstr);
         }
         _userDsaOnly.addAll(newSet);
         _userDsaOnly.retainAll(newSet);
         _userDsaList = hashes;
       } else {
         _userDsaOnly.clear();
         _userDsaList = "";
       }
     }
   }
 }