Code example for Mac

Methods: init

0
 
    private Mac lastMAC    = null;
 
    public MACData() throws NoSuchAlgorithmException, InvalidKeyException { 
        defaultMAC = Mac.getInstance(macType);
        defaultMAC.init(key);
    } 
 
    /** 
     * Adds a MAC of the data to the byte array following the data 
     *  
     * @param data 
     *            - the buffer holding the data for the MAC, and the MAC 
     * @param start 
     *            - inclusive start of data 
     * @param end 
     *            - inclusive end of data, mac added after this 
     * @throws javax.crypto.ShortBufferException 
     *             - if the buffer is insufficiently long to hold the mac 
     * @throws SecurityException 
     *             - no key yet provided for MAC calculation