JCEMacpublic class JCEMac extends MacSpi implements PBE
Fields Summary |
---|
private org.bouncycastle.crypto.Mac | macEngine | private int | pbeType | private int | pbeHash | private int | keySize |
Methods Summary |
---|
protected byte[] | engineDoFinal()
byte[] out = new byte[engineGetMacLength()];
macEngine.doFinal(out, 0);
return out;
| protected int | engineGetMacLength()
return macEngine.getMacSize();
| protected void | engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)
CipherParameters param;
if (key == null)
{
throw new InvalidKeyException("key is null");
}
if (key instanceof JCEPBEKey)
{
JCEPBEKey k = (JCEPBEKey)key;
if (k.getParam() != null)
{
param = k.getParam();
}
else if (params instanceof PBEParameterSpec)
{
param = PBE.Util.makePBEMacParameters(k, params);
}
else
{
throw new InvalidAlgorithmParameterException("PBE requires PBE parameters to be set.");
}
}
else if (params instanceof IvParameterSpec)
{
param = new ParametersWithIV(new KeyParameter(key.getEncoded()), ((IvParameterSpec)params).getIV());
}
else if (params == null)
{
param = new KeyParameter(key.getEncoded());
}
else
{
throw new InvalidAlgorithmParameterException("unknown parameter type.");
}
macEngine.init(param);
| protected void | engineReset()
macEngine.reset();
| protected void | engineUpdate(byte input)
macEngine.update(input);
| protected void | engineUpdate(byte[] input, int offset, int len)
macEngine.update(input, offset, len);
|
|