コード例 #1
0
  /**
   * Initializes the Mac with the given secret key and algorithm parameters.
   *
   * @param key the secret key.
   * @param params the algorithm parameters.
   * @exception InvalidKeyException if the given key is inappropriate for initializing this MAC.
   * @exception InvalidAlgorithmParameterException if the given algorithm parameters are
   *     inappropriate for this MAC.
   */
  void init(Key key, AlgorithmParameterSpec params)
      throws InvalidKeyException, InvalidAlgorithmParameterException {

    if (params != null) {
      throw new InvalidAlgorithmParameterException("SslMac does not use parameters");
    }

    if (!(key instanceof SecretKey)) {
      throw new InvalidKeyException("Secret key expected");
    }

    secret = key.getEncoded();
    if (secret == null || secret.length == 0) {
      throw new InvalidKeyException("Missing key data");
    }

    reset();
  }
コード例 #2
0
 protected void engineReset() {
   core.reset();
 }