Examples of HMAC


Examples of org.bouncycastle.crypto.macs.HMac

        doTest("ECIES with 256-bit", g, "ECIES", params);

       
        c1 = new IESCipher(new IESEngine(new ECDHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new DESEngine())));
       
        c2 = new IESCipher(new IESEngine(new ECDHBasicAgreement(),
                new KDF2BytesGenerator(new SHA1Digest()),
                new HMac(new SHA1Digest()),
                new PaddedBufferedBlockCipher(new DESEngine())))
   
        params = new IESParameterSpec(derivation, encoding, 128, 128);
     
        // Testing ECIES with default curve using DES
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

  private String mUser;

  static String getCheckCode(String secret)
      throws Base32String.DecodingException {
    final byte[] keyBytes = Base32String.decode(secret);
    Mac mac = new HMac(new SHA1Digest());
    mac.init(new KeyParameter(keyBytes));
    PasscodeGenerator pcg = new PasscodeGenerator(mac);
    return pcg.generateResponseCode(0L);
  }
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

   * @see ca.coolman.auth.oauth1.OAuthSigner#createSignature(java.lang.String,
   * java.lang.String)
   */
  protected byte[] createSignature(byte[] key, byte[] data) {
    SHA1Digest digest = new SHA1Digest();
    HMac mac = new HMac(digest);
    mac.init(new KeyParameter(key));
    mac.update(data, 0, data.length);
    byte[] b = new byte[digest.getDigestSize()];
    mac.doFinal(b, 0);
    return b;
  }
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

   *           If the key string is improperly encoded.
   */
  public static String computePin(String secret, Long counter) {
    try {
      final byte[] keyBytes = Base32String.decode(secret);
      Mac mac = new HMac(new SHA1Digest());
      mac.init(new KeyParameter(keyBytes));
      PasscodeGenerator pcg = new PasscodeGenerator(mac);
      if (counter == null) { // time-based totp
        return pcg.generateTimeoutCode();
      } else { // counter-based hotp
        return pcg.generateResponseCode(counter.longValue());
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac

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

Examples of org.bouncycastle.crypto.macs.HMac

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

Examples of org.bouncycastle.crypto.macs.HMac

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

Examples of org.bouncycastle.crypto.macs.HMac

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

Examples of org.bouncycastle.crypto.macs.HMac

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

Examples of org.bouncycastle.crypto.macs.HMac

    public static class SHA256
        extends JCEMac
    {
        public SHA256()
        {
            super(new HMac(new SHA256Digest()));
        }
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.