Search in sources :

Example 6 with OAEPEncoding

use of org.spongycastle.crypto.encodings.OAEPEncoding in project SightRemote by TebbeUbben.

the class Cryptograph method processRSA.

private static byte[] processRSA(AsymmetricKeyParameter key, byte[] data, boolean encrypt) throws InvalidCipherTextException {
    OAEPEncoding cipher = new OAEPEncoding(new RSAEngine());
    cipher.init(encrypt, key);
    return cipher.processBlock(data, 0, data.length);
}
Also used : OAEPEncoding(org.spongycastle.crypto.encodings.OAEPEncoding) RSAEngine(org.spongycastle.crypto.engines.RSAEngine)

Aggregations

OAEPEncoding (org.spongycastle.crypto.encodings.OAEPEncoding)6 Test (org.junit.Test)4 AsymmetricBlockCipher (org.spongycastle.crypto.AsymmetricBlockCipher)3 SHA1Digest (org.spongycastle.crypto.digests.SHA1Digest)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 SecureRandom (java.security.SecureRandom)1 AsymmetricCipherKeyPair (org.spongycastle.crypto.AsymmetricCipherKeyPair)1 Digest (org.spongycastle.crypto.Digest)1 SHA224Digest (org.spongycastle.crypto.digests.SHA224Digest)1 SHA256Digest (org.spongycastle.crypto.digests.SHA256Digest)1 SHA512Digest (org.spongycastle.crypto.digests.SHA512Digest)1 RSAEngine (org.spongycastle.crypto.engines.RSAEngine)1 RSAKeyPairGenerator (org.spongycastle.crypto.generators.RSAKeyPairGenerator)1 ParametersWithRandom (org.spongycastle.crypto.params.ParametersWithRandom)1 RSAKeyGenerationParameters (org.spongycastle.crypto.params.RSAKeyGenerationParameters)1 RSAKeyParameters (org.spongycastle.crypto.params.RSAKeyParameters)1