View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.juddi.cryptor;
17  
18  import java.security.InvalidAlgorithmParameterException;
19  import java.security.InvalidKeyException;
20  import java.security.NoSuchAlgorithmException;
21  
22  import javax.crypto.BadPaddingException;
23  import javax.crypto.IllegalBlockSizeException;
24  import javax.crypto.NoSuchPaddingException;
25  
26  /***
27   * @author Anou Manavalan
28   */
29  public interface Cryptor
30  {
31    /***
32     * Encrypt the string
33     */
34    byte[] encrypt(byte[] bytes)
35      throws  NoSuchPaddingException,
36              NoSuchAlgorithmException,
37              InvalidAlgorithmParameterException,
38              InvalidKeyException,
39              IllegalBlockSizeException,
40              BadPaddingException;
41  
42    String encrypt(String str)
43      throws  NoSuchPaddingException,
44              NoSuchAlgorithmException,
45              InvalidAlgorithmParameterException,
46              InvalidKeyException,
47              IllegalBlockSizeException,
48              BadPaddingException;
49  
50    /***
51     * Decrypt the string
52     */
53    byte[] decrypt(byte[] bytes)
54      throws  NoSuchPaddingException,
55              NoSuchAlgorithmException,
56              InvalidAlgorithmParameterException,
57              InvalidKeyException,
58              IllegalBlockSizeException,
59              BadPaddingException;
60  
61    String decrypt(String str)
62      throws  NoSuchPaddingException,
63              NoSuchAlgorithmException,
64              InvalidAlgorithmParameterException,
65              InvalidKeyException,
66              IllegalBlockSizeException,
67              BadPaddingException;
68  }