private static void extractKeys(KeyStore keystore,Properties props){
  String keyspec=props.getProperty(Configuration.LEVELDB_METADATA_AES);
  if (null != keyspec) {
    byte[] key=keystore.decodeKey(keyspec);
    Preconditions.checkArgument(16 == key.length || 24 == key.length || 32 == key.length,"Key " + Configuration.LEVELDB_METADATA_AES + " MUST be 128, 192 or 256 bits long.");
    keystore.setKey(KeyStore.AES_LEVELDB_METADATA,key);
  }
  keyspec=props.getProperty(Configuration.LEVELDB_DATA_AES);
  if (null != keyspec) {
    byte[] key=keystore.decodeKey(keyspec);
    Preconditions.checkArgument(16 == key.length || 24 == key.length || 32 == key.length,"Key " + Configuration.LEVELDB_DATA_AES + " MUST be 128, 192 or 256 bits long.");
    keystore.setKey(KeyStore.AES_LEVELDB_DATA,key);
  }
  keyspec=props.getProperty(Configuration.LEVELDB_INDEX_AES);
  if (null != keyspec) {
    byte[] key=keystore.decodeKey(keyspec);
    Preconditions.checkArgument(16 == key.length || 24 == key.length || 32 == key.length,"Key " + Configuration.LEVELDB_INDEX_AES + " MUST be 128, 192 or 256 bits long.");
    keystore.setKey(KeyStore.AES_LEVELDB_INDEX,key);
  }
  if (null != props.getProperty(Configuration.CONFIG_FETCH_PSK)) {
    keystore.setKey(KeyStore.SIPHASH_FETCH_PSK,keystore.decodeKey(props.getProperty(Configuration.CONFIG_FETCH_PSK)));
    Preconditions.checkArgument((16 == keystore.getKey(KeyStore.SIPHASH_FETCH_PSK).length),Configuration.CONFIG_FETCH_PSK + " MUST be 128 bits long.");
  }
}

private static void extractKeys ( KeyStore keystore , Properties props ) { String keyspec = props . getProperty ( Configuration . LEVELDB_METADATA_AES ) ; if ( null != keyspec ) { byte [ ] key = keystore . decodeKey ( keyspec ) ; Preconditions . checkArgument ( 16 == key . length || 24 == key . length || 32 == key . length , "Key " + Configuration . LEVELDB_METADATA_AES + " MUST be 128, 192 or 256 bits long." ) ; keystore . setKey ( KeyStore . AES_LEVELDB_METADATA , key ) ; } keyspec = props . getProperty ( Configuration . LEVELDB_DATA_AES ) ; if ( null != keyspec ) { byte [ ] key = keystore . decodeKey ( keyspec ) ; Preconditions . checkArgument ( 16 == key . length || 24 == key . length || 32 == key . length , "Key " + Configuration . LEVELDB_DATA_AES + " MUST be 128, 192 or 256 bits long." ) ; keystore . setKey ( KeyStore . AES_LEVELDB_DATA , key ) ; } keyspec = props . getProperty ( Configuration . LEVELDB_INDEX_AES ) ; if ( null != keyspec ) { byte [ ] key = keystore . decodeKey ( keyspec ) ; Preconditions . checkArgument ( 16 == key . length || 24 == key . length || 32 == key . length , "Key " + Configuration . LEVELDB_INDEX_AES + " MUST be 128, 192 or 256 bits long." ) ; keystore . setKey ( KeyStore . AES_LEVELDB_INDEX , key ) ; } if ( null != props . getProperty ( Configuration . CONFIG_FETCH_PSK ) ) { keystore . setKey ( KeyStore . SIPHASH_FETCH_PSK , keystore . decodeKey ( props . getProperty ( Configuration . CONFIG_FETCH_PSK ) ) ) ; Preconditions . checkArgument ( ( 16 == keystore . getKey ( KeyStore . SIPHASH_FETCH_PSK ) . length ) , Configuration . CONFIG_FETCH_PSK + " MUST be 128 bits long." ) ; } }
extract ingress related keys and populate the keystore with them .
