javax.crypto.Mac.getProvider()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中javax.crypto.Mac.getProvider()方法的一些代码示例,展示了Mac.getProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mac.getProvider()方法的具体详情如下:
包路径:javax.crypto.Mac
类名称:Mac
方法名:getProvider

Mac.getProvider介绍

[英]Returns the provider of this Mac instance.
[中]返回此Mac实例的提供程序。

代码示例

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method engineGetJCEAlgorithmString
 *
 * {@inheritDoc}
 */
protected String engineGetJCEProviderName() {
  return this.macAlgorithm.getProvider().getName();
}

代码示例来源:origin: com.sshtools/maverick-common

public String getProvider() {
  if(mac==null) {
    return null;
  }
  return mac.getProvider().getName();
}

代码示例来源:origin: com.amazonaws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: aws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: com.amazonaws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: com.amazonaws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: com.addc/addc-security

/**
 * Get a Mac with the wrapped characteristics
 * 
 * @return A Mac
 * @throws NoSuchAlgorithmException
 *             If the algorithm name is incorrect
 */
public Mac getMac() throws NoSuchAlgorithmException {
  String name= getHmacName();
  Provider provider= providers.getProvider(name);
  Mac mac;
  if (provider == null) {
    mac= Mac.getInstance(name);
  } else {
    mac= Mac.getInstance(name, provider);
  }
  LOGGER.debug(FOUND_CL_ALG_PROV, mac.getClass().getSimpleName(), name, mac.getProvider().getName());
  return mac;
}

代码示例来源:origin: aws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: aws/aws-dynamodb-encryption-java

/**
 * 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());
}

代码示例来源:origin: com.addc/addc-security

/**
 * Get a Mac with the wrapped characteristics and the given key
 * 
 * @param key
 *            The key used to generate the Mac
 * @return The mac
 * @throws NoSuchAlgorithmException
 *             If the algorithm name is incorrect
 * @throws InvalidKeyException
 *             If the key is incorrect
 */
public Mac getMac(Key key) throws InvalidKeyException, NoSuchAlgorithmException {
  final Mac mac= getMac();
  mac.init(key);
  LOGGER.debug("Instantiated algorithm {} with provider {}", hmacName, mac.getProvider().getInfo());
  return mac;
}

相关文章