Methods Summary |
---|
protected javax.crypto.SecretKey | engineGenerateSecret(java.security.spec.KeySpec keySpec)
if (keySpec instanceof SecretKeySpec)
{
return (SecretKey)keySpec;
}
throw new InvalidKeySpecException("Invalid KeySpec");
|
protected java.security.spec.KeySpec | engineGetKeySpec(javax.crypto.SecretKey key, java.lang.Class keySpec)
if (keySpec == null)
{
throw new InvalidKeySpecException("keySpec parameter is null");
}
if (key == null)
{
throw new InvalidKeySpecException("key parameter is null");
}
if (SecretKeySpec.class.isAssignableFrom(keySpec))
{
return new SecretKeySpec(key.getEncoded(), algName);
}
try
{
Class[] parameters = { byte[].class };
Constructor c = keySpec.getConstructor(parameters);
Object[] p = new Object[1];
p[0] = key.getEncoded();
return (KeySpec)c.newInstance(p);
}
catch (Exception e)
{
throw new InvalidKeySpecException(e.toString());
}
|
protected javax.crypto.SecretKey | engineTranslateKey(javax.crypto.SecretKey key)
if (key == null)
{
throw new InvalidKeyException("key parameter is null");
}
if (!key.getAlgorithm().equalsIgnoreCase(algName))
{
throw new InvalidKeyException("Key not of type " + algName + ".");
}
return new SecretKeySpec(key.getEncoded(), algName);
|