View Javadoc

1   /*
2    * $Id: MockEncryptionStrategy.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tck.security;
12  
13  import org.mule.api.EncryptionStrategy;
14  import org.mule.api.lifecycle.InitialisationException;
15  import org.mule.api.security.CryptoFailureException;
16  
17  import java.io.ByteArrayInputStream;
18  import java.io.InputStream;
19  
20  /**
21   * Empty mock for tests
22   */
23  public class MockEncryptionStrategy extends Named implements EncryptionStrategy
24  {
25  
26      public byte[] encrypt(byte[] data, Object info) throws CryptoFailureException
27      {
28          return new byte[0];
29      }
30  
31      public byte[] decrypt(byte[] data, Object info) throws CryptoFailureException
32      {
33          return new byte[0];
34      }
35  
36      public void initialise() throws InitialisationException
37      {
38          // nothing to do
39      }
40  
41      public InputStream decrypt(InputStream data, Object info) throws CryptoFailureException
42      {
43          return new ByteArrayInputStream(new byte[0]);
44      }
45  
46      public InputStream encrypt(InputStream data, Object info) throws CryptoFailureException
47      {
48          return new ByteArrayInputStream(new byte[0]);
49      }
50  
51  }