Examples of SecretKey


Examples of javax.crypto.SecretKey

     
      PBEKeySpec keySpec = new PBEKeySpec(password);
 
      SecretKeyFactory keyFactory = SecretKeyFactory.getInstance( PBE_ALG );
 
      SecretKey key = keyFactory.generateSecret(keySpec);
 
      PBEParameterSpec paramSpec = new PBEParameterSpec(salt, PBE_ITERATIONS);
 
      Cipher cipher = Cipher.getInstance( PBE_ALG );
     
View Full Code Here

Examples of javax.crypto.SecretKey

     * @throws java.lang.Exception
     */
    @Override public final void afterPropertiesSet() throws Exception {
        Security.addProvider(new BouncyCastleProvider());
        cipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        SecretKey key = getEncryptionKey();
        cipherer.init(Cipher.ENCRYPT_MODE, key);
        decipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        decipherer.init(Cipher.DECRYPT_MODE, key);
        if (logger.isInfoEnabled()) logger.info("Cryptography loaded with [DESede/ECB/PKCS5Padding] algorityhms and initialized");
    }
View Full Code Here

Examples of javax.crypto.SecretKey

      key_length = anyKey.sizeOf();
    } else {
      key = anvil.util.Conversions.getBytes(anyKey.toString());
      key_length = key.length;
    }
    SecretKey sk = new javax.crypto.spec.SecretKeySpec(key, 0, key_length, algorithm);
    _mac = Mac.getInstance(algorithm);
    _mac.init(sk);
  }
View Full Code Here

Examples of javax.crypto.SecretKey

    public final DES3CiphererDecipherer init() throws Exception {
        Security.addProvider(new BouncyCastleProvider());
        cipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        KeyGenerator keyGen = KeyGenerator.getInstance("DESede");
        keyGen.init(168);
        SecretKey key = keyGen.generateKey();
        cipherer.init(Cipher.ENCRYPT_MODE, key);
        decipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        decipherer.init(Cipher.DECRYPT_MODE, key);
        if (log.isDebugEnabled()) log.debug("Cryptography loaded with [DESede/ECB/PKCS5Padding] algorityhms and initialized");
        return this;
View Full Code Here

Examples of javax.crypto.SecretKey

        }
    }

    public static Association generateHmacSha1(String handle, int expiryIn)
    {
        SecretKey macKey = generateMacSha1Key();

        if (DEBUG) _log.debug("Generated SHA1 MAC key: " + macKey);

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expiryIn);
    }
View Full Code Here

Examples of javax.crypto.SecretKey

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expiryIn);
    }

    public static Association createHmacSha1(String handle, byte[] macKeyBytes, int expiryIn)
    {
        SecretKey macKey = createMacKey(HMAC_SHA1_ALGORITHM, macKeyBytes);

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expiryIn);
    }
View Full Code Here

Examples of javax.crypto.SecretKey

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expiryIn);
    }

    public static Association createHmacSha1(String handle, byte[] macKeyBytes, Date expDate)
    {
        SecretKey macKey = createMacKey(HMAC_SHA1_ALGORITHM, macKeyBytes);

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expDate);
    }
View Full Code Here

Examples of javax.crypto.SecretKey

        return new Association(TYPE_HMAC_SHA1, handle, macKey, expDate);
    }

    public static Association generateHmacSha256(String handle, int expiryIn)
    {
        SecretKey macKey = generateMacSha256Key();

        if (DEBUG) _log.debug("Generated SHA256 MAC key: " + macKey);

        return new Association(TYPE_HMAC_SHA256, handle, macKey, expiryIn);
    }
View Full Code Here

Examples of javax.crypto.SecretKey

        return new Association(TYPE_HMAC_SHA256, handle, macKey, expiryIn);
    }

    public static Association createHmacSha256(String handle, byte[] macKeyBytes, int expiryIn)
    {
        SecretKey macKey = createMacKey(HMAC_SHA256_ALGORITHM, macKeyBytes);

        return new Association(TYPE_HMAC_SHA256, handle, macKey, expiryIn);
    }
View Full Code Here

Examples of javax.crypto.SecretKey

        return new Association(TYPE_HMAC_SHA256, handle, macKey, expiryIn);
    }

    public static Association createHmacSha256(String handle, byte[] macKeyBytes, Date expDate)
    {
        SecretKey macKey = createMacKey(HMAC_SHA256_ALGORITHM, macKeyBytes);

        return new Association(TYPE_HMAC_SHA256, handle, macKey, expDate);
    }
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.