本文整理了Java中org.bouncycastle.crypto.macs.HMac.getMacSize()
方法的一些代码示例,展示了HMac.getMacSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HMac.getMacSize()
方法的具体详情如下:
包路径:org.bouncycastle.crypto.macs.HMac
类名称:HMac
方法名:getMacSize
暂无
代码示例来源:origin: com.hynnet/jradius-extended
/**
* @return The Keysize of the mac.
*/
protected int getSize()
{
return mac.getMacSize();
}
代码示例来源:origin: net.jradius/jradius-extended
/**
* @return The Keysize of the mac.
*/
protected int getSize()
{
return mac.getMacSize();
}
代码示例来源:origin: coova/jradius
/**
* @return The Keysize of the mac.
*/
protected int getSize()
{
return mac.getMacSize();
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
/**
* Base constructor.
*
* @param digest digest to build the HMAC on.
*/
public HMacDSAKCalculator(Digest digest)
{
this.hMac = new HMac(digest);
this.V = new byte[hMac.getMacSize()];
this.K = new byte[hMac.getMacSize()];
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Base constructor.
*
* @param digest digest to build the HMAC on.
*/
public HMacDSAKCalculator(Digest digest)
{
this.hMac = new HMac(digest);
this.V = new byte[hMac.getMacSize()];
this.K = new byte[hMac.getMacSize()];
}
代码示例来源:origin: redfish64/TinyTravelTracker
/** 10 bytes */
public byte[] getFinalAuthentication() {
// MAC / based on encIn + PASSWORD + SALT (encryption was successful)
byte[] macBytes = new byte[ mac.getMacSize() ];
mac.doFinal( macBytes, 0 );
byte[] macBytes10 = new byte[10];
System.arraycopy( macBytes, 0, macBytes10, 0, 10 );
return macBytes10;
}
代码示例来源:origin: de.idyl/winzipaes
/** 10 bytes */
public byte[] getFinalAuthentication() {
// MAC / based on encIn + PASSWORD + SALT (encryption was successful)
byte[] macBytes = new byte[ mac.getMacSize() ];
mac.doFinal( macBytes, 0 );
byte[] macBytes10 = new byte[10];
System.arraycopy( macBytes, 0, macBytes10, 0, 10 );
return macBytes10;
}
代码示例来源:origin: de.idyl/winzipaes
public byte[] getFinalAuthentication() {
byte[] macBytes = new byte[ mac.getMacSize() ];
mac.doFinal( macBytes, 0 );
byte[] macBytes10 = new byte[10];
System.arraycopy( macBytes, 0, macBytes10, 0, 10 );
return macBytes10;
}
代码示例来源:origin: redfish64/TinyTravelTracker
public byte[] getFinalAuthentication() {
byte[] macBytes = new byte[ mac.getMacSize() ];
mac.doFinal( macBytes, 0 );
byte[] macBytes10 = new byte[10];
System.arraycopy( macBytes, 0, macBytes10, 0, 10 );
return macBytes10;
}
代码示例来源:origin: stackoverflow.com
public static String signRequest(String uri, String secret) throws Exception {
byte[] r = uri.getBytes("US-ASCII");
byte[] k = secret.getBytes("US-ASCII");
HMac hmac = new HMac(new RIPEMD160Digest());
hmac.init(new KeyParameter(k));
hmac.update(r, 0, r.length);
byte[] out = new byte[hmac.getMacSize()];
hmac.doFinal(out, 0);
return new String((new Hex()).encode(out), "US-ASCII");
}
代码示例来源:origin: stackoverflow.com
CipherParameters p = new KeyParameter(key.getBytes("UTF-8"));
WhirlpoolDigest w = new WhirlpoolDigest();
HMac hm = new HMac(w);
hm.init(p);
hm.update(inbytes, 0, inbytes.length);
byte[] result = new byte[hm.getMacSize()];
hm.doFinal(result, 0);
代码示例来源:origin: org.xipki.tk/security
private byte[] hmac(final byte[] contentToSign,
final HashAlgoType hashAlgo) {
HMac hmac = new HMac(hashAlgo.createDigest());
hmac.update(contentToSign, 0, contentToSign.length);
byte[] signature = new byte[hmac.getMacSize()];
hmac.doFinal(signature, 0);
return signature;
}
代码示例来源:origin: org.xipki/security
private byte[] hmac(byte[] contentToSign, HashAlgo hashAlgo) {
HMac hmac = new HMac(hashAlgo.createDigest());
hmac.init(new KeyParameter(signingKey.getEncoded()));
hmac.update(contentToSign, 0, contentToSign.length);
byte[] signature = new byte[hmac.getMacSize()];
hmac.doFinal(signature, 0);
return signature;
}
代码示例来源:origin: encryptedsystems/Clusion
public static byte[] generateHmac(byte[] key, String msg) throws UnsupportedEncodingException {
HMac hmac = new HMac(new SHA256Digest());
byte[] result = new byte[hmac.getMacSize()];
byte[] msgAry = msg.getBytes("UTF-8");
hmac.init(new KeyParameter(key));
hmac.reset();
hmac.update(msgAry, 0, msgAry.length);
hmac.doFinal(result, 0);
return result;
}
代码示例来源:origin: encryptedsystems/Clusion
public static byte[] generateHmac512(byte[] key, String msg) throws UnsupportedEncodingException {
HMac hmac = new HMac(new SHA512Digest());
byte[] result = new byte[hmac.getMacSize()];
byte[] msgAry = msg.getBytes("UTF-8");
hmac.init(new KeyParameter(key));
hmac.reset();
hmac.update(msgAry, 0, msgAry.length);
hmac.doFinal(result, 0);
return result;
}
代码示例来源:origin: ZZMarquis/gmhelper
public static byte[] hmac(byte[] key, byte[] srcData) {
KeyParameter keyParameter = new KeyParameter(key);
SM3Digest digest = new SM3Digest();
HMac mac = new HMac(digest);
mac.init(keyParameter);
mac.update(srcData, 0, srcData.length);
byte[] result = new byte[mac.getMacSize()];
mac.doFinal(result, 0);
return result;
}
}
代码示例来源:origin: net.aholbrook.paseto/crypto-v1-bc
@Override
public byte[] hmacSha384(byte[] m, byte[] key) {
validateHmacSha384(m, key);
Digest digest = new SHA384Digest();
HMac hmac = new HMac(digest);
hmac.init(new KeyParameter(key));
byte[] out = new byte[hmac.getMacSize()];
hmac.update(m, 0, m.length);
hmac.doFinal(out, 0);
return out;
}
代码示例来源:origin: ontio/ontology-java-sdk
public static byte[] hmacSha512(byte[] keyBytes, byte[] text) {
HMac hmac = new HMac(new SHA512Digest());
byte[] resBuf = new byte[hmac.getMacSize()];
CipherParameters pm = new KeyParameter(keyBytes);
hmac.init(pm);
hmac.update(text, 0, text.length);
hmac.doFinal(resBuf, 0);
return resBuf;
}
代码示例来源:origin: ontio/ontology-java-sdk
public static byte[] hmacSha512(byte[] keyBytes, byte[] text) {
HMac hmac = new HMac(new SHA512Digest());
byte[] resBuf = new byte[hmac.getMacSize()];
CipherParameters pm = new KeyParameter(keyBytes);
hmac.init(pm);
hmac.update(text, 0, text.length);
hmac.doFinal(resBuf, 0);
return resBuf;
}
代码示例来源:origin: encryptedsystems/Clusion
public static byte[] generateHmac(byte[] key, byte[] msg) throws UnsupportedEncodingException {
HMac hmac = new HMac(new SHA256Digest());
byte[] result = new byte[hmac.getMacSize()];
hmac.init(new KeyParameter(key));
hmac.reset();
hmac.update(msg, 0, msg.length);
hmac.doFinal(result, 0);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!