@Override protected Object convertResult() throws ExecutionException { try { Object result = instance.getCryptor().unsealObject(super.convertResult()); if (result instanceof ExceptionHolder) { throw new ExecutionException(((ExceptionHolder)result).getException()); } if (result instanceof Throwable) { throw new ExecutionException((Throwable)result); } return result; } catch (CryptoException e) { throw new ExecutionException(e); } }
/** * Test encryption (and decryption) for specified string. */ public void helpTestEncryptDecrypt( String cleartext ) throws CryptoException { // Encrypt the cleartext into ciphertext byte[] ciphertext = cryptor.encrypt( cleartext.getBytes(Charset.forName("UTF-8"))); byte[] cleartext2 = cryptor.decrypt( ciphertext ); assertArrayEquals(cleartext.getBytes(Charset.forName("UTF-8")), cleartext2); }
void sendResult(Message result, boolean encrypt) { if (encrypt) { try { result.setContents(socketClientInstance.getCryptor().sealObject(result.getContents())); } catch (CryptoException e) { throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40071, e); } } socketClientInstance.send(result, messageKey); }
/** * Test the {@link Cryptor#encrypt} method. */ @Test public void testNeg_DecryptNullString() throws Exception { // Decrypt the Base64 encoded ciphertext back to the original cleartext try { cryptor.decrypt( null ); fail("expected exception"); //$NON-NLS-1$ } catch ( CryptoException e ) { //expected } }
Secure secure = method.getAnnotation(Secure.class); if (secure != null && (!secure.optional() || secureOptional)) { message.setContents(instance.getCryptor().sealObject(message.getContents()));
Secure secure = method.getAnnotation(Secure.class); if (secure != null && (!secure.optional() || secureOptional)) { message.setContents(instance.getCryptor().sealObject(message.getContents()));
@Override protected Object convertResult() throws ExecutionException { try { Object result = instance.getCryptor().unsealObject(super.convertResult()); if (result instanceof ExceptionHolder) { throw new ExecutionException(((ExceptionHolder)result).getException()); } if (result instanceof Throwable) { throw new ExecutionException((Throwable)result); } return result; } catch (CryptoException e) { throw new ExecutionException(e); } }
message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents())); if (!(message.getContents() instanceof ServiceInvocationStruct)) { throw new AssertionError("unknown message contents"); //$NON-NLS-1$