KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > ws > objects > KeyStore


1 package org.ejbca.core.protocol.ws.objects;
2
3 import java.io.ByteArrayOutputStream JavaDoc;
4 import java.io.IOException JavaDoc;
5 import java.security.KeyStoreException JavaDoc;
6 import java.security.NoSuchAlgorithmException JavaDoc;
7 import java.security.cert.CertificateException JavaDoc;
8
9 import org.ejbca.util.Base64;
10
11 public class KeyStore {
12     
13     private byte[] keystoreData = null;
14     
15     public KeyStore(){
16         
17     }
18
19     public KeyStore(java.security.KeyStore JavaDoc keystore, String JavaDoc password) throws KeyStoreException JavaDoc, NoSuchAlgorithmException JavaDoc, IOException JavaDoc, CertificateException JavaDoc{
20         
21         ByteArrayOutputStream JavaDoc baos = new ByteArrayOutputStream JavaDoc();
22         keystore.store(baos,password.toCharArray());
23         keystoreData = Base64.encode(baos.toByteArray());
24     }
25
26
27     
28     /**
29      * @return Returns the keystoreData, in Base64 encoded format.
30      */

31     public byte[] getKeystoreData() {
32         return keystoreData;
33     }
34
35     /**
36      * @param keystoreData The keystoreData to set, in Base64 encoded format.
37      */

38     public void setKeystoreData(byte[] keystoreData) {
39         this.keystoreData = keystoreData;
40     }
41
42
43 }
44
Popular Tags