Examples of Hmac


Examples of org.bouncycastle.crypto.macs.HMac

    public static class SHA384
        extends JCEMac
    {
        public SHA384()
        {
            super(new HMac(new SHA384Digest()));
        }
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

    public static class SHA512
        extends JCEMac
    {
        public SHA512()
        {
            super(new HMac(new SHA512Digest()));
        }
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

    public static class RIPEMD128
        extends JCEMac
    {
        public RIPEMD128()
        {
            super(new HMac(new RIPEMD128Digest()));
        }
View Full Code Here

Examples of org.bouncycastle2.crypto.macs.HMac

    public static class RIPEMD128
        extends JCEMac
    {
        public RIPEMD128()
        {
            super(new HMac(new RIPEMD128Digest()));
        }
View Full Code Here

Examples of org.jboss.aerogear.security.otp.api.Hmac

    private int hash(String secret, long interval) {
        byte[] hash = new byte[0];
        try {
            //Base32 encoding is just a requirement for google authenticator. We can remove it on the next releases.
            hash = new Hmac(Hash.SHA1, Base32.decode(secret), interval).digest();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (InvalidKeyException e) {
            e.printStackTrace();
        } catch (Base32.DecodingException e) {
View Full Code Here

Examples of org.xbill.DNS.utils.HMAC

  if (error != Rcode.BADTIME)
    timeSigned = new Date();
  else
    timeSigned = old.getTimeSigned();
  int fudge;
  HMAC hmac = null;
  if (error == Rcode.NOERROR || error == Rcode.BADTIME)
    hmac = new HMAC(digest, key);

  fudge = Options.intValue("tsigfudge");
  if (fudge < 0 || fudge > 0x7FFF)
    fudge = FUDGE;

  if (old != null) {
    DNSOutput out = new DNSOutput();
    out.writeU16(old.getSignature().length);
    if (hmac != null) {
      hmac.update(out.toByteArray());
      hmac.update(old.getSignature());
    }
  }

  /* Digest the message */
  if (hmac != null)
    hmac.update(b);

  DNSOutput out = new DNSOutput();
  name.toWireCanonical(out);
  out.writeU16(DClass.ANY)/* class */
  out.writeU32(0);    /* ttl */
  alg.toWireCanonical(out);
  long time = timeSigned.getTime() / 1000;
  int timeHigh = (int) (time >> 32);
  long timeLow = (time & 0xFFFFFFFFL);
  out.writeU16(timeHigh);
  out.writeU32(timeLow);
  out.writeU16(fudge);

  out.writeU16(error);
  out.writeU16(0); /* No other data */

  if (hmac != null)
    hmac.update(out.toByteArray());

  byte [] signature;
  if (hmac != null)
    signature = hmac.sign();
  else
    signature = new byte[0];

  byte [] other = null;
  if (error == Rcode.BADTIME) {
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.