예제 #1
0
  private boolean establishKeyMaterial() {
    try {
      int mac_cs_key_len = MAC.getKeyLen(kxs.np.mac_algo_client_to_server);
      int enc_cs_key_len = BlockCipherFactory.getKeySize(kxs.np.enc_algo_client_to_server);
      int enc_cs_block_len = BlockCipherFactory.getBlockSize(kxs.np.enc_algo_client_to_server);

      int mac_sc_key_len = MAC.getKeyLen(kxs.np.mac_algo_server_to_client);
      int enc_sc_key_len = BlockCipherFactory.getKeySize(kxs.np.enc_algo_server_to_client);
      int enc_sc_block_len = BlockCipherFactory.getBlockSize(kxs.np.enc_algo_server_to_client);

      km =
          KeyMaterial.create(
              "SHA1",
              kxs.H,
              kxs.K,
              sessionId,
              enc_cs_key_len,
              enc_cs_block_len,
              mac_cs_key_len,
              enc_sc_key_len,
              enc_sc_block_len,
              mac_sc_key_len);
    } catch (IllegalArgumentException e) {
      return false;
    }
    return true;
  }