SingleKeyStoreSpi.java
4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.replication.impl.transport;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.KeyStoreSpi;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.util.Date;
import java.util.Enumeration;
import java.util.NoSuchElementException;
class SingleKeyStoreSpi
extends KeyStoreSpi {
private final KeyStore keyStore;
final String alias;
public SingleKeyStoreSpi(KeyStore keyStore, String alias) {
this.keyStore = keyStore;
this.alias = alias;
}
@Override
public Key engineGetKey(String alias, char[] password) throws NoSuchAlgorithmException, UnrecoverableKeyException {
try {
return this.keyStore.getKey(alias, password);
}
catch (KeyStoreException e) {
return null;
}
}
@Override
public Certificate[] engineGetCertificateChain(String alias) {
try {
return this.keyStore.getCertificateChain(alias);
}
catch (KeyStoreException e) {
return null;
}
}
@Override
public Certificate engineGetCertificate(String alias) {
try {
return this.keyStore.getCertificate(alias);
}
catch (KeyStoreException e) {
return null;
}
}
@Override
public Date engineGetCreationDate(String alias) {
try {
return this.keyStore.getCreationDate(alias);
}
catch (KeyStoreException e) {
return null;
}
}
@Override
public void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException {
}
@Override
public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain) throws KeyStoreException {
}
@Override
public void engineSetCertificateEntry(String alias, Certificate cert) throws KeyStoreException {
}
@Override
public void engineDeleteEntry(String alias) throws KeyStoreException {
}
public Enumeration engineAliases() {
return new Enumeration(){
private boolean done;
@Override
public boolean hasMoreElements() {
return !this.done;
}
public Object nextElement() {
if (!this.done) {
this.done = true;
return SingleKeyStoreSpi.this.alias;
}
throw new NoSuchElementException();
}
};
}
@Override
public boolean engineContainsAlias(String alias) {
try {
return this.keyStore.containsAlias(alias);
}
catch (KeyStoreException e) {
return false;
}
}
@Override
public int engineSize() {
try {
return this.keyStore.size();
}
catch (KeyStoreException e) {
return 0;
}
}
@Override
public boolean engineIsKeyEntry(String alias) {
try {
return this.keyStore.isKeyEntry(alias);
}
catch (KeyStoreException e) {
return false;
}
}
@Override
public boolean engineIsCertificateEntry(String alias) {
try {
return this.keyStore.isCertificateEntry(alias);
}
catch (KeyStoreException e) {
return false;
}
}
@Override
public String engineGetCertificateAlias(Certificate cert) {
try {
return this.keyStore.getCertificateAlias(cert);
}
catch (KeyStoreException e) {
return null;
}
}
@Override
public void engineStore(OutputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException {
}
@Override
public void engineLoad(InputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException {
}
}