MAC(MacAlg macAlg,ProtocolVersion protocolVersion,SecretKey key) throws NoSuchAlgorithmException, InvalidKeyException {
  super(protocolVersion);
  this.macAlg=macAlg;
  String algorithm;
  boolean tls=(protocolVersion.v >= ProtocolVersion.TLS10.v);
  if (macAlg == M_MD5) {
    algorithm=tls ? "HmacMD5" : "SslMacMD5";
  }
 else   if (macAlg == M_SHA) {
    algorithm=tls ? "HmacSHA1" : "SslMacSHA1";
  }
 else   if (macAlg == M_SHA256) {
    algorithm="HmacSHA256";
  }
 else   if (macAlg == M_SHA384) {
    algorithm="HmacSHA384";
  }
 else {
    throw new RuntimeException("Unknown Mac " + macAlg);
  }
  mac=JsseJce.getMac(algorithm);
  mac.init(key);
}

MAC ( MacAlg macAlg , ProtocolVersion protocolVersion , SecretKey key ) throws NoSuchAlgorithmException , InvalidKeyException { super ( protocolVersion ) ; this . macAlg = macAlg ; String algorithm ; boolean tls = ( protocolVersion . v >= ProtocolVersion . TLS10 . v ) ; if ( macAlg == M_MD5 ) { algorithm = tls ? "HmacMD5" : "SslMacMD5" ; } else if ( macAlg == M_SHA ) { algorithm = tls ? "HmacSHA1" : "SslMacSHA1" ; } else if ( macAlg == M_SHA256 ) { algorithm = "HmacSHA256" ; } else if ( macAlg == M_SHA384 ) { algorithm = "HmacSHA384" ; } else { throw new RuntimeException ( "Unknown Mac " + macAlg ) ; } mac = JsseJce . getMac ( algorithm ) ; mac . init ( key ) ; }
set up , configured for the given ssl / tls mac type and version .
