Package javax.crypto

Examples of javax.crypto.Mac.reset()


    String macOid = macAlg.getObjectId().getId();
    byte[] protectedBytes = ret.getProtectedBytes();
    Mac mac = Mac.getInstance(macOid, "BC");
    SecretKey key = new SecretKeySpec(basekey, macOid);
    mac.init(key);
    mac.reset();
    mac.update(protectedBytes, 0, protectedBytes.length);
    byte[] out = mac.doFinal();
    DERBitString bs = new DERBitString(out);

    // Finally store the protection bytes in the msg
View Full Code Here


        catch (Exception e)
        {
            fail("Failed - exception " + e.toString(), e);
        }

        mac.reset();
       
        mac.update(message, 0, message.length);

        out = mac.doFinal();
View Full Code Here

        mac = Mac.getInstance(hmacName, "BC");

        mac.init(key);

        mac.reset();
       
        mac.update(message, 0, message.length);

        out = mac.doFinal();
View Full Code Here

        Mac hMac = Mac.getInstance("HMACSHA1");
        SecretKeySpec sKey = new SecretKeySpec(secret, "HMACSHA1");
        hMac.init(sKey);
        hMac.update(aBytes);
        aBytes = hMac.doFinal();
        hMac.reset();
        hMac.init(sKey);
        hMac.update(aBytes);
        hMac.update(seed);
        result = hMac.doFinal();
       
View Full Code Here

        if(requiredSize % aBytes.length != 0)
            rounds++;
       
        for(int i = 0; i < rounds; i ++){
           
            hMac.reset();
            hMac.init(sKey);
            hMac.update(aBytes);
            hMac.update(seed);
            byte[] generated = hMac.doFinal();
            int takeBytes;
View Full Code Here

       
        SecretKey sk = new SecretKeySpec(key, algorithm);
      try {
            Mac mac = Mac.getInstance(algorithm);
            mac.init(sk);
            mac.reset();
            mac.update(msg);
            msg = mac.doFinal();
            return MD5.stringify(msg).toUpperCase();
        }
        catch(Exception e) {
View Full Code Here

     * @throws org.jpos.security.jceadapter.JCEHandlerException
     */
    public byte[] generateMAC(byte[] data, Key kd, String macAlgorithm) throws JCEHandlerException {
        Mac mac = assignMACEngine(new MacEngineKey(macAlgorithm, kd));
        synchronized (mac) {
            mac.reset();
            return mac.doFinal(data);
        }
    }

    /**
 
View Full Code Here

         mac.init(key);
         mac.update(A);
         A = mac.doFinal();

         // now calculate HMAC_hash(secret, A + seed)
         mac.reset();
         mac.init(key);
         mac.update(A);
         mac.update(seed);
         partialResult = mac.doFinal();
View Full Code Here

            mac.init(key);
            mac.update(A);
            A = mac.doFinal();

            // now calculate HMAC_hash(secret, A + seed)
            mac.reset();
            mac.init(key);
            mac.update(A);
            mac.update(seed);
            partialResult = mac.doFinal();
View Full Code Here

        Mac hMac = Mac.getInstance("HMACSHA1");
        SecretKeySpec sKey = new SecretKeySpec(secret, "HMACSHA1");
        hMac.init(sKey);
        hMac.update(aBytes);
        aBytes = hMac.doFinal();
        hMac.reset();
        hMac.init(sKey);
        hMac.update(aBytes);
        hMac.update(seed);
        result = hMac.doFinal();
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.