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

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

本文整理了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

  1. /**
  2. * Method engineGetJCEAlgorithmString
  3. *
  4. * {@inheritDoc}
  5. */
  6. protected String engineGetJCEProviderName() {
  7. return this.macAlgorithm.getProvider().getName();
  8. }

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

  1. public String getProvider() {
  2. if(mac==null) {
  3. return null;
  4. }
  5. return mac.getProvider().getName();
  6. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @param provider
  12. * the provider
  13. * @return the new <code>Hkdf</code> object
  14. * @throws NoSuchAlgorithmException
  15. * if a MacSpi implementation for the specified algorithm is not
  16. * available from the specified provider.
  17. */
  18. public static Hkdf getInstance(final String algorithm,
  19. final Provider provider) throws NoSuchAlgorithmException {
  20. // Constructed specifically to sanity-test arguments.
  21. Mac mac = Mac.getInstance(algorithm, provider);
  22. return new Hkdf(algorithm, mac.getProvider());
  23. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @return the new <code>Hkdf</code> object
  12. * @throws NoSuchAlgorithmException
  13. * if no Provider supports a MacSpi implementation for the
  14. * specified algorithm.
  15. */
  16. public static Hkdf getInstance(final String algorithm)
  17. throws NoSuchAlgorithmException {
  18. // Constructed specifically to sanity-test arguments.
  19. Mac mac = Mac.getInstance(algorithm);
  20. return new Hkdf(algorithm, mac.getProvider());
  21. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @return the new <code>Hkdf</code> object
  12. * @throws NoSuchAlgorithmException
  13. * if no Provider supports a MacSpi implementation for the
  14. * specified algorithm.
  15. */
  16. public static Hkdf getInstance(final String algorithm)
  17. throws NoSuchAlgorithmException {
  18. // Constructed specifically to sanity-test arguments.
  19. Mac mac = Mac.getInstance(algorithm);
  20. return new Hkdf(algorithm, mac.getProvider());
  21. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @param provider
  12. * the name of the provider
  13. * @return the new <code>Hkdf</code> object
  14. * @throws NoSuchAlgorithmException
  15. * if a MacSpi implementation for the specified algorithm is not
  16. * available from the specified provider.
  17. * @throws NoSuchProviderException
  18. * if the specified provider is not registered in the security
  19. * provider list.
  20. */
  21. public static Hkdf getInstance(final String algorithm, final String provider)
  22. throws NoSuchAlgorithmException, NoSuchProviderException {
  23. // Constructed specifically to sanity-test arguments.
  24. Mac mac = Mac.getInstance(algorithm, provider);
  25. return new Hkdf(algorithm, mac.getProvider());
  26. }

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

  1. /**
  2. * Get a Mac with the wrapped characteristics
  3. *
  4. * @return A Mac
  5. * @throws NoSuchAlgorithmException
  6. * If the algorithm name is incorrect
  7. */
  8. public Mac getMac() throws NoSuchAlgorithmException {
  9. String name= getHmacName();
  10. Provider provider= providers.getProvider(name);
  11. Mac mac;
  12. if (provider == null) {
  13. mac= Mac.getInstance(name);
  14. } else {
  15. mac= Mac.getInstance(name, provider);
  16. }
  17. LOGGER.debug(FOUND_CL_ALG_PROV, mac.getClass().getSimpleName(), name, mac.getProvider().getName());
  18. return mac;
  19. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @param provider
  12. * the name of the provider
  13. * @return the new <code>Hkdf</code> object
  14. * @throws NoSuchAlgorithmException
  15. * if a MacSpi implementation for the specified algorithm is not
  16. * available from the specified provider.
  17. * @throws NoSuchProviderException
  18. * if the specified provider is not registered in the security
  19. * provider list.
  20. */
  21. public static Hkdf getInstance(final String algorithm, final String provider)
  22. throws NoSuchAlgorithmException, NoSuchProviderException {
  23. // Constructed specifically to sanity-test arguments.
  24. Mac mac = Mac.getInstance(algorithm, provider);
  25. return new Hkdf(algorithm, mac.getProvider());
  26. }

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

  1. /**
  2. * Returns an <code>Hkdf</code> object using the specified algorithm.
  3. *
  4. * @param algorithm
  5. * the standard name of the requested MAC algorithm. See the Mac
  6. * section in the <a href=
  7. * "http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac"
  8. * > Java Cryptography Architecture Standard Algorithm Name
  9. * Documentation</a> for information about standard algorithm
  10. * names.
  11. * @param provider
  12. * the provider
  13. * @return the new <code>Hkdf</code> object
  14. * @throws NoSuchAlgorithmException
  15. * if a MacSpi implementation for the specified algorithm is not
  16. * available from the specified provider.
  17. */
  18. public static Hkdf getInstance(final String algorithm,
  19. final Provider provider) throws NoSuchAlgorithmException {
  20. // Constructed specifically to sanity-test arguments.
  21. Mac mac = Mac.getInstance(algorithm, provider);
  22. return new Hkdf(algorithm, mac.getProvider());
  23. }

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

  1. /**
  2. * Get a Mac with the wrapped characteristics and the given key
  3. *
  4. * @param key
  5. * The key used to generate the Mac
  6. * @return The mac
  7. * @throws NoSuchAlgorithmException
  8. * If the algorithm name is incorrect
  9. * @throws InvalidKeyException
  10. * If the key is incorrect
  11. */
  12. public Mac getMac(Key key) throws InvalidKeyException, NoSuchAlgorithmException {
  13. final Mac mac= getMac();
  14. mac.init(key);
  15. LOGGER.debug("Instantiated algorithm {} with provider {}", hmacName, mac.getProvider().getInfo());
  16. return mac;
  17. }

相关文章