1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.security.admin;
17
18 import java.io.Serializable;
19 import java.security.KeyStore;
20 import java.util.Date;
21 import java.util.HashMap;
22 import java.util.Map;
23
24
25
26
27
28
29
30 public class KeyStoreEntryDataContainer implements Serializable {
31
32 private static final String DISPLAYABLE_ENTRY_TYPE_TRUSTED_CERTIFICATE = "Trusted Certificate";
33 private static final String DISPLAYABLE_ENTRY_TYPE_PRIVATE_KEY = "Private Key";
34 private static final String DISPLAYABLE_ENTRY_TYPE_SECRET_KEY = "Secret Key";
35
36 public static final Map<Class<? extends KeyStore.Entry>,String> DISPLAYABLE_ENTRY_TYPES = new HashMap<Class<? extends KeyStore.Entry>,String>();
37 static {
38 DISPLAYABLE_ENTRY_TYPES.put(KeyStore.TrustedCertificateEntry.class, DISPLAYABLE_ENTRY_TYPE_TRUSTED_CERTIFICATE);
39 DISPLAYABLE_ENTRY_TYPES.put(KeyStore.PrivateKeyEntry.class, DISPLAYABLE_ENTRY_TYPE_PRIVATE_KEY);
40 DISPLAYABLE_ENTRY_TYPES.put(KeyStore.SecretKeyEntry.class, DISPLAYABLE_ENTRY_TYPE_SECRET_KEY);
41 }
42
43 private String alias;
44 private Date createDate;
45 private Class<? extends KeyStore.Entry> type;
46
47 public KeyStoreEntryDataContainer(String alias, Date createDate) {
48 super();
49 this.alias = alias;
50 this.createDate = createDate;
51 }
52
53 public boolean isAllowsRemoval() {
54 if (KeyStore.TrustedCertificateEntry.class.equals(type)) {
55 return true;
56 }
57 return false;
58 }
59
60 public String getDisplayType() {
61 return DISPLAYABLE_ENTRY_TYPES.get(getType());
62 }
63
64
65
66
67 public String getAlias() {
68 return this.alias;
69 }
70
71
72
73
74 public void setAlias(String alias) {
75 this.alias = alias;
76 }
77
78
79
80
81 public Date getCreateDate() {
82 return this.createDate;
83 }
84
85
86
87
88 public void setCreateDate(Date createDate) {
89 this.createDate = createDate;
90 }
91
92
93
94
95 public Class<? extends KeyStore.Entry> getType() {
96 return this.type;
97 }
98
99
100
101
102 public void setType(Class<? extends KeyStore.Entry> type) {
103 this.type = type;
104 }
105
106 }