blob: 5ad157de19fa120d315cbc85c320cb2b64ad6374 (
plain)
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
|
package org.sufficientlysecure.keychain.javacard;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
import org.sufficientlysecure.keychain.util.Passphrase;
import java.io.IOException;
public class CachingBaseJavacardDevice extends BaseJavacardDevice {
private byte[] mFingerprintsCache;
private String mUserIdCache;
private byte[] mAidCache;
public CachingBaseJavacardDevice(final Transport mTransport) {
super(mTransport);
}
@Override
public byte[] getFingerprints() throws IOException {
if (mFingerprintsCache == null) {
mFingerprintsCache = super.getFingerprints();
}
return mFingerprintsCache;
}
@Override
public String getUserId() throws IOException {
if (mUserIdCache == null) {
mUserIdCache = super.getUserId();
}
return mUserIdCache;
}
@Override
public byte[] getAid() throws IOException {
if (mAidCache == null) {
mAidCache = super.getAid();
}
return mAidCache;
}
@Override
public void changeKey(final CanonicalizedSecretKey secretKey, final Passphrase passphrase) throws IOException {
super.changeKey(secretKey, passphrase);
mFingerprintsCache = null;
}
}
|