org.testifyproject.bouncycastle.cms.bc.CMSUtils Maven / Gradle / Ivy
The newest version!
package org.testifyproject.bouncycastle.cms.bc;
import org.testifyproject.bouncycastle.crypto.CipherParameters;
import org.testifyproject.bouncycastle.crypto.params.KeyParameter;
import org.testifyproject.bouncycastle.operator.GenericKey;
class CMSUtils
{
static CipherParameters getBcKey(GenericKey key)
{
if (key.getRepresentation() instanceof CipherParameters)
{
return (CipherParameters)key.getRepresentation();
}
if (key.getRepresentation() instanceof byte[])
{
return new KeyParameter((byte[])key.getRepresentation());
}
throw new IllegalArgumentException("unknown generic key type");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy