title: how to get message authentication code for BouncyCastle AES-CCM encrypted message
body: <p>I have encrypted some text as follows:</p>
  
  <pre><code>Cipher in = Cipher.getInstance("AES/CCM/NoPadding", "BC");
  in.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(_nonce));
  encoded = in.doFinal(payload);
  </code></pre>
  
  <p>Works great. I want to get the MAC, so I try this:</p>
  
  <pre><code>byte[] K = Hex.decode(bek.getBytes());
  Key key = new SecretKeySpec(K, "AES");
  Mac mac = Mac.getInstance("AES/CCM/NoPadding", "BC");
  </code></pre>
  
  <p>but get a "no such algorithm: AES/CCM/NoPadding for provider BC". </p>
  
  <p>So, what algorithm is used to extract the MAC from an AES/CCM encrypted message? Thanks!</p>