org.spongycastle.crypto.CipherParameters Java Examples
The following examples show how to use
org.spongycastle.crypto.CipherParameters.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EOSECDSASigner.java From token-core-android with Apache License 2.0 | 6 votes |
public void init( boolean forSigning, CipherParameters param) { SecureRandom providedRandom = null; if (forSigning) { if (param instanceof ParametersWithRandom) { ParametersWithRandom rParam = (ParametersWithRandom) param; this.key = (ECPrivateKeyParameters) rParam.getParameters(); providedRandom = rParam.getRandom(); } else { this.key = (ECPrivateKeyParameters) param; } } else { this.key = (ECPublicKeyParameters) param; } this.random = initSecureRandom(forSigning && !kCalculator.isDeterministic(), providedRandom); }
Example #2
Source File: SecureUtils.java From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static byte[] calculateCMAC(final byte[] data, final byte[] key) { final byte[] cmac = new byte[16]; CipherParameters cipherParameters = new KeyParameter(key); BlockCipher blockCipher = new AESEngine(); CMac mac = new CMac(blockCipher); mac.init(cipherParameters); mac.update(data, 0, data.length); mac.doFinal(cmac, 0); return cmac; }
Example #3
Source File: SecureUtils.java From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static byte[] encryptWithAES(final byte[] data, final byte[] key) { final byte[] encrypted = new byte[data.length]; final CipherParameters cipherParameters = new KeyParameter(key); final AESLightEngine engine = new AESLightEngine(); engine.init(true, cipherParameters); engine.processBlock(data, 0, encrypted, 0); return encrypted; }