Java Code Examples for javax.crypto.Mac#getProvider()

The following examples show how to use javax.crypto.Mac#getProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HmacKeyDerivationFunction.java    From aws-encryption-sdk-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>HmacKeyDerivationFunction</code> object using the specified algorithm.
 *
 * @param algorithm the standard name of the requested MAC algorithm. See the Mac
 *                  section in the <a href=
 *                  "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *                  > Java Cryptography Architecture Standard Algorithm Name
 *                  Documentation</a> for information about standard algorithm
 *                  names.
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException if no Provider supports a MacSpi implementation for the
 *                                  specified algorithm.
 */
public static HmacKeyDerivationFunction getInstance(final String algorithm)
        throws NoSuchAlgorithmException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm);
    return new HmacKeyDerivationFunction(algorithm, mac.getProvider());
}
 
Example 2
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if no Provider supports a MacSpi implementation for the
 *             specified algorithm.
 */
public static Hkdf getInstance(final String algorithm)
        throws NoSuchAlgorithmException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm);
    return new Hkdf(algorithm, mac.getProvider());
}
 
Example 3
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @param provider
 *            the name of the provider
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if a MacSpi implementation for the specified algorithm is not
 *             available from the specified provider.
 * @throws NoSuchProviderException
 *             if the specified provider is not registered in the security
 *             provider list.
 */
public static Hkdf getInstance(final String algorithm, final String provider)
        throws NoSuchAlgorithmException, NoSuchProviderException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm, provider);
    return new Hkdf(algorithm, mac.getProvider());
}
 
Example 4
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @param provider
 *            the provider
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if a MacSpi implementation for the specified algorithm is not
 *             available from the specified provider.
 */
public static Hkdf getInstance(final String algorithm,
        final Provider provider) throws NoSuchAlgorithmException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm, provider);
    return new Hkdf(algorithm, mac.getProvider());
}
 
Example 5
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if no Provider supports a MacSpi implementation for the
 *             specified algorithm.
 */
public static Hkdf getInstance(final String algorithm)
        throws NoSuchAlgorithmException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm);
    return new Hkdf(algorithm, mac.getProvider());
}
 
Example 6
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @param provider
 *            the name of the provider
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if a MacSpi implementation for the specified algorithm is not
 *             available from the specified provider.
 * @throws NoSuchProviderException
 *             if the specified provider is not registered in the security
 *             provider list.
 */
public static Hkdf getInstance(final String algorithm, final String provider)
        throws NoSuchAlgorithmException, NoSuchProviderException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm, provider);
    return new Hkdf(algorithm, mac.getProvider());
}
 
Example 7
Source File: Hkdf.java    From aws-dynamodb-encryption-java with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an <code>Hkdf</code> object using the specified algorithm.
 *
 * @param algorithm
 *            the standard name of the requested MAC algorithm. See the Mac
 *            section in the <a href=
 *            "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
 *            > Java Cryptography Architecture Standard Algorithm Name
 *            Documentation</a> for information about standard algorithm
 *            names.
 * @param provider
 *            the provider
 * @return the new <code>Hkdf</code> object
 * @throws NoSuchAlgorithmException
 *             if a MacSpi implementation for the specified algorithm is not
 *             available from the specified provider.
 */
public static Hkdf getInstance(final String algorithm,
        final Provider provider) throws NoSuchAlgorithmException {
    // Constructed specifically to sanity-test arguments.
    Mac mac = Mac.getInstance(algorithm, provider);
    return new Hkdf(algorithm, mac.getProvider());
}