KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ca > caadmin > extendedcaservices > KeyRecoveryCAServiceRequest


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.core.model.ca.caadmin.extendedcaservices;
15
16 import java.io.Serializable JavaDoc;
17 import java.security.KeyPair JavaDoc;
18
19
20 /**
21  * Class used when requesting key recovery related services from a CA.
22  *
23  * @version $Id: KeyRecoveryCAServiceRequest.java,v 1.1 2006/01/17 20:30:56 anatom Exp $
24  */

25 public class KeyRecoveryCAServiceRequest extends ExtendedCAServiceRequest implements Serializable JavaDoc {
26  
27     public static final int COMMAND_ENCRYPTKEYS = 1;
28     public static final int COMMAND_DECRYPTKEYS = 2;
29     
30     private int command;
31     private byte[] keydata;
32     private KeyPair JavaDoc keypair;
33     /** Constructor for KeyRecoveryCAServiceRequest
34      */

35     public KeyRecoveryCAServiceRequest(int command, byte[] keydata) {
36         this.command = command;
37         this.keydata = keydata;
38     }
39
40     /** Constructor for KeyRecoveryCAServiceRequest
41      */

42     public KeyRecoveryCAServiceRequest(int command, KeyPair JavaDoc keypair) {
43         this.command = command;
44         this.keypair = keypair;
45     }
46     
47     public int getCommand(){
48         return command;
49     }
50     
51     /**
52      * Returns data beloning to the decrypt keys request, returns null oterwise.
53      */

54     
55     public byte[] getKeyData(){
56         if(command != COMMAND_DECRYPTKEYS)
57           return null;
58         return keydata;
59     }
60
61     /**
62      * Returns data beloning to the encrypt keys request, returns null oterwise.
63      */

64     
65     public KeyPair JavaDoc getKeyPair(){
66         if(command != COMMAND_ENCRYPTKEYS)
67             return null;
68         return keypair;
69     }
70     
71 }
72
Popular Tags