Lines Matching refs:Mac
43 * (MAC) algorithm.
45 * <p> A MAC provides a way to check
52 * <p> A MAC mechanism that is based on cryptographic hash functions is
57 * <p> Android provides the following <code>Mac</code> algorithms
130 * <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
131 * Mac section</a> of the
139 public class Mac implements Cloneable {
142 Debug.getInstance("jca", "Mac");
150 // The name of the MAC algorithm.
159 * Creates a MAC object.
165 protected Mac(MacSpi macSpi, Provider provider, String algorithm) {
172 private Mac(String algorithm) {
178 * Returns the algorithm name of this <code>Mac</code> object.
182 * <code>Mac</code> object.
184 * @return the algorithm name of this <code>Mac</code> object.
191 * Returns a <code>Mac</code> object that implements the
192 * specified MAC algorithm.
196 * A new Mac object encapsulating the
203 * @param algorithm the standard name of the requested MAC algorithm.
204 * See the Mac section in the <a href=
205 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
209 * @return the new <code>Mac</code> object.
217 public static final Mac getInstance(String algorithm)
219 List services = GetInstance.getServices("Mac", algorithm);
227 return new Mac(algorithm);
234 * Returns a <code>Mac</code> object that implements the
235 * specified MAC algorithm.
237 * <p> A new Mac object encapsulating the
245 * @param algorithm the standard name of the requested MAC algorithm.
246 * See the Mac section in the <a href=
247 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
253 * @return the new <code>Mac</code> object.
267 public static final Mac getInstance(String algorithm, String provider)
270 ("Mac", MacSpi.class, algorithm, provider);
271 return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
275 * Returns a <code>Mac</code> object that implements the
276 * specified MAC algorithm.
278 * <p> A new Mac object encapsulating the
283 * @param algorithm the standard name of the requested MAC algorithm.
284 * See the Mac section in the <a href=
285 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
291 * @return the new <code>Mac</code> object.
302 public static final Mac getInstance(String algorithm, Provider provider)
305 ("Mac", MacSpi.class, algorithm, provider);
306 return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
328 debug.println("Mac.init() not first method "
338 for (Service s : GetInstance.getServices("Mac", algorithm)) {
371 for (Service s : GetInstance.getServices("Mac", algorithm)) {
412 * Returns the provider of this <code>Mac</code> object.
414 * @return the provider of this <code>Mac</code> object.
422 * Returns the length of the MAC in bytes.
424 * @return the MAC length in bytes.
432 * Initializes this <code>Mac</code> object with the given key.
437 * initializing this MAC.
453 * Initializes this <code>Mac</code> object with the given key and
460 * initializing this MAC.
462 * parameters are inappropriate for this MAC.
479 * @exception IllegalStateException if this <code>Mac</code> has not been
485 throw new IllegalStateException("MAC not initialized");
495 * @exception IllegalStateException if this <code>Mac</code> has not been
501 throw new IllegalStateException("MAC not initialized");
516 * @exception IllegalStateException if this <code>Mac</code> has not been
523 throw new IllegalStateException("MAC not initialized");
541 * @exception IllegalStateException if this <code>Mac</code> has not been
548 throw new IllegalStateException("MAC not initialized");
557 * Finishes the MAC operation.
559 * <p>A call to this method resets this <code>Mac</code> object to the
563 * That is, the object is reset and available to generate another MAC from
566 * (In order to reuse this <code>Mac</code> object with a different key,
570 * @return the MAC result.
572 * @exception IllegalStateException if this <code>Mac</code> has not been
578 throw new IllegalStateException("MAC not initialized");
580 byte[] mac = spi.engineDoFinal();
582 return mac;
586 * Finishes the MAC operation.
588 * <p>A call to this method resets this <code>Mac</code> object to the
592 * That is, the object is reset and available to generate another MAC from
595 * (In order to reuse this <code>Mac</code> object with a different key,
599 * <p>The MAC result is stored in <code>output</code>, starting at
602 * @param output the buffer where the MAC result is stored
603 * @param outOffset the offset in <code>output</code> where the MAC is
608 * @exception IllegalStateException if this <code>Mac</code> has not been
616 throw new IllegalStateException("MAC not initialized");
621 ("Cannot store MAC in output buffer");
623 byte[] mac = doFinal();
624 System.arraycopy(mac, 0, output, outOffset, macLen);
629 * Processes the given array of bytes and finishes the MAC operation.
631 * <p>A call to this method resets this <code>Mac</code> object to the
635 * That is, the object is reset and available to generate another MAC from
638 * (In order to reuse this <code>Mac</code> object with a different key,
643 * @return the MAC result.
645 * @exception IllegalStateException if this <code>Mac</code> has not been
652 throw new IllegalStateException("MAC not initialized");
659 * Resets this <code>Mac</code> object.
661 * <p>A call to this method resets this <code>Mac</code> object to the
665 * That is, the object is reset and available to generate another MAC from
668 * (In order to reuse this <code>Mac</code> object with a different key,
687 Mac that = (Mac)super.clone();
693 * Returns the {@code MacSpi} backing this {@code Mac} or {@code null} if no {@code MacSpi} is
694 * backing this {@code Mac}.