• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GENERATED SOURCE. DO NOT MODIFY. */
2 package com.android.org.bouncycastle.crypto;
3 
4 
5 /**
6  * The base interface for implementations of message authentication codes (MACs).
7  * @hide This class is not part of the Android public SDK API
8  */
9 public interface Mac
10 {
11     /**
12      * Initialise the MAC.
13      *
14      * @param params the key and other data required by the MAC.
15      * @exception IllegalArgumentException if the params argument is
16      * inappropriate.
17      */
init(CipherParameters params)18     public void init(CipherParameters params)
19         throws IllegalArgumentException;
20 
21     /**
22      * Return the name of the algorithm the MAC implements.
23      *
24      * @return the name of the algorithm the MAC implements.
25      */
getAlgorithmName()26     public String getAlgorithmName();
27 
28     /**
29      * Return the block size for this MAC (in bytes).
30      *
31      * @return the block size for this MAC in bytes.
32      */
getMacSize()33     public int getMacSize();
34 
35     /**
36      * add a single byte to the mac for processing.
37      *
38      * @param in the byte to be processed.
39      * @exception IllegalStateException if the MAC is not initialised.
40      */
update(byte in)41     public void update(byte in)
42         throws IllegalStateException;
43 
44     /**
45      * @param in the array containing the input.
46      * @param inOff the index in the array the data begins at.
47      * @param len the length of the input starting at inOff.
48      * @exception IllegalStateException if the MAC is not initialised.
49      * @exception DataLengthException if there isn't enough data in in.
50      */
update(byte[] in, int inOff, int len)51     public void update(byte[] in, int inOff, int len)
52         throws DataLengthException, IllegalStateException;
53 
54     /**
55      * Compute the final stage of the MAC writing the output to the out
56      * parameter.
57      * <p>
58      * doFinal leaves the MAC in the same state it was after the last init.
59      *
60      * @param out the array the MAC is to be output to.
61      * @param outOff the offset into the out buffer the output is to start at.
62      * @exception DataLengthException if there isn't enough space in out.
63      * @exception IllegalStateException if the MAC is not initialised.
64      */
doFinal(byte[] out, int outOff)65     public int doFinal(byte[] out, int outOff)
66         throws DataLengthException, IllegalStateException;
67 
68     /**
69      * Reset the MAC. At the end of resetting the MAC should be in the
70      * in the same state it was after the last init (if there was one).
71      */
reset()72     public void reset();
73 }
74