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

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

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

Mac.getMacLength介绍

[英]Returns the length of this MAC (in bytes).
[中]返回此MAC的长度(字节)。

代码示例

代码示例来源:origin: google/guava

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: google/j2objc

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: wildfly/wildfly

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: apache/nifi

  1. int hLen = mac.getMacLength();

代码示例来源:origin: prestodb/presto

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: aws-amplify/aws-sdk-android

  1. /**
  2. * @param ikm REQUIRED: The input key material.
  3. * @param salt REQUIRED: Random bytes for salt.
  4. */
  5. public void init(byte[] ikm, byte[] salt) {
  6. byte[] realSalt = salt == null ? EMPTY_ARRAY : (byte[]) salt.clone();
  7. byte[] rawKeyMaterial = EMPTY_ARRAY;
  8. try {
  9. final Mac e = Mac.getInstance(this.algorithm);
  10. if (realSalt.length == 0) {
  11. realSalt = new byte[e.getMacLength()];
  12. Arrays.fill(realSalt, (byte) 0);
  13. }
  14. e.init(new SecretKeySpec(realSalt, this.algorithm));
  15. rawKeyMaterial = e.doFinal(ikm);
  16. final SecretKeySpec key = new SecretKeySpec(rawKeyMaterial, this.algorithm);
  17. Arrays.fill(rawKeyMaterial, (byte) 0);
  18. this.unsafeInitWithoutKeyExtraction(key);
  19. } catch (final GeneralSecurityException var10) {
  20. throw new RuntimeException("Unexpected exception", var10);
  21. } finally {
  22. Arrays.fill(rawKeyMaterial, (byte) 0);
  23. }
  24. }

代码示例来源:origin: aws-amplify/aws-sdk-android

  1. } else {
  2. final Mac mac = this.createMac();
  3. if (length > MAX_KEY_SIZE * mac.getMacLength()) {
  4. throw new IllegalArgumentException(
  5. "Requested keys may not be longer than 255 times the underlying HMAC length.");

代码示例来源:origin: RUB-NDS/TLS-Attacker

  1. @Override
  2. public int getMacLength() {
  3. return mac.getMacLength();
  4. }

代码示例来源:origin: org.jboss.seam.security/seam-security

  1. public MacBasedPRF(String macAlgorithm, String provider) {
  2. this.macAlgorithm = macAlgorithm;
  3. try {
  4. mac = Mac.getInstance(macAlgorithm, provider);
  5. hLen = mac.getMacLength();
  6. } catch (NoSuchAlgorithmException e) {
  7. throw new RuntimeException(e);
  8. } catch (NoSuchProviderException e) {
  9. throw new RuntimeException(e);
  10. }
  11. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: org.apache.drill/drill-shaded-guava

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: org.testifyproject.external/external-guava

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: com.facebook.presto/presto-jdbc

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: io.prestosql/presto-jdbc

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: io.bitsensor/proto

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: org.weakref/jmxutils

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: seznam/euphoria

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

  1. MacHashFunction(String algorithmName, Key key, String toString) {
  2. this.prototype = getMac(algorithmName, key);
  3. this.key = checkNotNull(key);
  4. this.toString = checkNotNull(toString);
  5. this.bits = prototype.getMacLength() * Byte.SIZE;
  6. this.supportsClone = supportsClone(prototype);
  7. }

代码示例来源:origin: RUB-NDS/TLS-Attacker

  1. private void prepareBinderValue() {
  2. try {
  3. HKDFAlgorithm hkdfAlgortihm = AlgorithmResolver.getHKDFAlgorithm(pskBinder.getBinderCipherConfig());
  4. int macLen = Mac.getInstance(hkdfAlgortihm.getMacAlgorithm().getJavaName()).getMacLength();
  5. pskBinder.setBinderEntry(new byte[macLen]);
  6. pskBinder.setBinderEntryLength(pskBinder.getBinderEntry().getValue().length);
  7. } catch (NoSuchAlgorithmException ex) {
  8. LOGGER.warn(ex);
  9. }
  10. }

相关文章