Home | History | Annotate | Download | only in crypto

Lines Matching refs:Mac

45  * (MAC) algorithm.
47 * <p> A MAC provides a way to check
54 * <p> A MAC mechanism that is based on cryptographic hash functions is
59 * <p> Android provides the following <code>Mac</code> algorithms:
148 * <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
149 * Mac section</a> of the
157 public class Mac implements Cloneable {
163 Debug.isOn("engine=") && !Debug.isOn("mac");
172 // The name of the MAC algorithm.
181 * Creates a MAC object.
187 protected Mac(MacSpi macSpi, Provider provider, String algorithm) {
194 private Mac(String algorithm) {
200 * Returns the algorithm name of this <code>Mac</code> object.
204 * <code>Mac</code> object.
206 * @return the algorithm name of this <code>Mac</code> object.
213 * Returns a <code>Mac</code> object that implements the
214 * specified MAC algorithm.
218 * A new Mac object encapsulating the
225 * @param algorithm the standard name of the requested MAC algorithm.
226 * See the Mac section in the <a href=
227 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
231 * @return the new <code>Mac</code> object.
239 public static final Mac getInstance(String algorithm)
241 List<Service> services = GetInstance.getServices("Mac", algorithm);
249 return new Mac(algorithm);
256 * Returns a <code>Mac</code> object that implements the
257 * specified MAC algorithm.
259 * <p> A new Mac object encapsulating the
267 * @param algorithm the standard name of the requested MAC algorithm.
268 * See the Mac section in the <a href=
269 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
275 * @return the new <code>Mac</code> object.
289 public static final Mac getInstance(String algorithm, String provider)
292 ("Mac", MacSpi.class, algorithm, provider);
293 return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
297 * Returns a <code>Mac</code> object that implements the
298 * specified MAC algorithm.
300 * <p> A new Mac object encapsulating the
305 * @param algorithm the standard name of the requested MAC algorithm.
306 * See the Mac section in the <a href=
307 * "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Mac">
313 * @return the new <code>Mac</code> object.
324 public static final Mac getInstance(String algorithm, Provider provider)
327 ("Mac", MacSpi.class, algorithm, provider);
328 return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
351 debug.println("Mac.init() not first method "
362 for (Service s : GetInstance.getServices("Mac", algorithm)) {
395 for (Service s : GetInstance.getServices("Mac", algorithm)) {
436 * Returns the provider of this <code>Mac</code> object.
438 * @return the provider of this <code>Mac</code> object.
446 * Returns the length of the MAC in bytes.
448 * @return the MAC length in bytes.
456 * Initializes this <code>Mac</code> object with the given key.
461 * initializing this MAC.
477 pdebug.println("Mac." + algorithm + " algorithm from: " +
484 * Initializes this <code>Mac</code> object with the given key and
491 * initializing this MAC.
493 * parameters are inappropriate for this MAC.
506 pdebug.println("Mac." + algorithm + " algorithm from: " +
517 * @exception IllegalStateException if this <code>Mac</code> has not been
523 throw new IllegalStateException("MAC not initialized");
533 * @exception IllegalStateException if this <code>Mac</code> has not been
539 throw new IllegalStateException("MAC not initialized");
554 * @exception IllegalStateException if this <code>Mac</code> has not been
561 throw new IllegalStateException("MAC not initialized");
579 * @exception IllegalStateException if this <code>Mac</code> has not been
586 throw new IllegalStateException("MAC not initialized");
595 * Finishes the MAC operation.
597 * <p>A call to this method resets this <code>Mac</code> object to the
601 * That is, the object is reset and available to generate another MAC from
604 * (In order to reuse this <code>Mac</code> object with a different key,
608 * @return the MAC result.
610 * @exception IllegalStateException if this <code>Mac</code> has not been
616 throw new IllegalStateException("MAC not initialized");
618 byte[] mac = spi.engineDoFinal();
620 return mac;
624 * Finishes the MAC operation.
626 * <p>A call to this method resets this <code>Mac</code> object to the
630 * That is, the object is reset and available to generate another MAC from
633 * (In order to reuse this <code>Mac</code> object with a different key,
637 * <p>The MAC result is stored in <code>output</code>, starting at
640 * @param output the buffer where the MAC result is stored
641 * @param outOffset the offset in <code>output</code> where the MAC is
646 * @exception IllegalStateException if this <code>Mac</code> has not been
654 throw new IllegalStateException("MAC not initialized");
659 ("Cannot store MAC in output buffer");
661 byte[] mac = doFinal();
662 System.arraycopy(mac, 0, output, outOffset, macLen);
667 * Processes the given array of bytes and finishes the MAC operation.
669 * <p>A call to this method resets this <code>Mac</code> object to the
673 * That is, the object is reset and available to generate another MAC from
676 * (In order to reuse this <code>Mac</code> object with a different key,
681 * @return the MAC result.
683 * @exception IllegalStateException if this <code>Mac</code> has not been
690 throw new IllegalStateException("MAC not initialized");
697 * Resets this <code>Mac</code> object.
699 * <p>A call to this method resets this <code>Mac</code> object to the
703 * That is, the object is reset and available to generate another MAC from
706 * (In order to reuse this <code>Mac</code> object with a different key,
725 Mac that = (Mac)super.clone();
731 * Returns the {@code MacSpi} backing this {@code Mac} or {@code null} if no {@code MacSpi} is
732 * backing this {@code Mac}.