本文整理了Java中javax.crypto.Mac.getMacLength()
方法的一些代码示例,展示了Mac.getMacLength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mac.getMacLength()
方法的具体详情如下:
包路径:javax.crypto.Mac
类名称:Mac
方法名:getMacLength
[英]Returns the length of this MAC (in bytes).
[中]返回此MAC的长度(字节)。
代码示例来源:origin: google/guava
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: google/j2objc
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: wildfly/wildfly
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: apache/nifi
int hLen = mac.getMacLength();
代码示例来源:origin: prestodb/presto
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: aws-amplify/aws-sdk-android
/**
* @param ikm REQUIRED: The input key material.
* @param salt REQUIRED: Random bytes for salt.
*/
public void init(byte[] ikm, byte[] salt) {
byte[] realSalt = salt == null ? EMPTY_ARRAY : (byte[]) salt.clone();
byte[] rawKeyMaterial = EMPTY_ARRAY;
try {
final Mac e = Mac.getInstance(this.algorithm);
if (realSalt.length == 0) {
realSalt = new byte[e.getMacLength()];
Arrays.fill(realSalt, (byte) 0);
}
e.init(new SecretKeySpec(realSalt, this.algorithm));
rawKeyMaterial = e.doFinal(ikm);
final SecretKeySpec key = new SecretKeySpec(rawKeyMaterial, this.algorithm);
Arrays.fill(rawKeyMaterial, (byte) 0);
this.unsafeInitWithoutKeyExtraction(key);
} catch (final GeneralSecurityException var10) {
throw new RuntimeException("Unexpected exception", var10);
} finally {
Arrays.fill(rawKeyMaterial, (byte) 0);
}
}
代码示例来源:origin: aws-amplify/aws-sdk-android
} else {
final Mac mac = this.createMac();
if (length > MAX_KEY_SIZE * mac.getMacLength()) {
throw new IllegalArgumentException(
"Requested keys may not be longer than 255 times the underlying HMAC length.");
代码示例来源:origin: RUB-NDS/TLS-Attacker
@Override
public int getMacLength() {
return mac.getMacLength();
}
代码示例来源:origin: org.jboss.seam.security/seam-security
public MacBasedPRF(String macAlgorithm, String provider) {
this.macAlgorithm = macAlgorithm;
try {
mac = Mac.getInstance(macAlgorithm, provider);
hLen = mac.getMacLength();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: org.apache.drill/drill-shaded-guava
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: org.testifyproject.external/external-guava
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: com.facebook.presto/presto-jdbc
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: io.prestosql/presto-jdbc
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: io.bitsensor/proto
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: org.weakref/jmxutils
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: seznam/euphoria
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous
MacHashFunction(String algorithmName, Key key, String toString) {
this.prototype = getMac(algorithmName, key);
this.key = checkNotNull(key);
this.toString = checkNotNull(toString);
this.bits = prototype.getMacLength() * Byte.SIZE;
this.supportsClone = supportsClone(prototype);
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
private void prepareBinderValue() {
try {
HKDFAlgorithm hkdfAlgortihm = AlgorithmResolver.getHKDFAlgorithm(pskBinder.getBinderCipherConfig());
int macLen = Mac.getInstance(hkdfAlgortihm.getMacAlgorithm().getJavaName()).getMacLength();
pskBinder.setBinderEntry(new byte[macLen]);
pskBinder.setBinderEntryLength(pskBinder.getBinderEntry().getValue().length);
} catch (NoSuchAlgorithmException ex) {
LOGGER.warn(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!