/**
   * 初始化密钥
   *
   * @throws Exception
   */
  @Before
  public void initKey() throws Exception {

    Map<String, Object> keyMap = ECDSACoder.initKey();

    publicKey = ECDSACoder.getPublicKey(keyMap);

    privateKey = ECDSACoder.getPrivateKey(keyMap);

    System.err.println("公钥: \n" + Base64.encodeBase64String(publicKey));
    System.err.println("私钥: \n" + Base64.encodeBase64String(privateKey));
  }
  /**
   * 校验
   *
   * @throws Exception
   */
  @Test
  public void test() throws Exception {

    String inputStr = "ECDSA 数字签名";
    byte[] data = inputStr.getBytes();

    // 产生签名
    long startTIme = System.currentTimeMillis();
    byte[] sign = ECDSACoder.sign(data, privateKey);
    System.err.println("签名:\r" + Hex.encodeHexString(sign));
    long endTime = System.currentTimeMillis();
    System.out.println(endTime - startTIme + "ms");
    // 验证签名
    boolean status = ECDSACoder.verify(data, publicKey, sign);
    System.err.println("状态:\r" + status);
    Assert.assertTrue(status);
  }