/
EucaKeyStore.java
42 lines (34 loc) · 1.47 KB
/
EucaKeyStore.java
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
package com.eucalyptus.auth.util;
import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.cert.X509Certificate;
import org.apache.log4j.Logger;
import com.eucalyptus.util.EucalyptusProperties;
import com.eucalyptus.util.SubDirectory;
public class EucaKeyStore extends AbstractKeyStore {
public static String FORMAT = "pkcs12";
private static String KEY_STORE_PASS = EucalyptusProperties.NAME;
private static String FILENAME = "euca.p12";
private static Logger LOG = Logger.getLogger( EucaKeyStore.class );
private static AbstractKeyStore singleton = EucaKeyStore.getInstance( );
public static AbstractKeyStore getInstance( ) {
synchronized ( EucaKeyStore.class ) {
if ( EucaKeyStore.singleton == null ) {
try {
EucaKeyStore.singleton = new EucaKeyStore( );
} catch ( final Exception e ) {
EucaKeyStore.LOG.error( e, e );
}
}
}
return EucaKeyStore.singleton;
}
private EucaKeyStore( ) throws GeneralSecurityException, IOException {
super( SubDirectory.KEYS.toString( ) + File.separator + EucaKeyStore.FILENAME, EucaKeyStore.KEY_STORE_PASS, EucaKeyStore.FORMAT );
}
@Override
public boolean check( ) throws GeneralSecurityException {
return (this.getCertificate( EucalyptusProperties.WWW_NAME )!= null)&&(this.getCertificate( EucalyptusProperties.NAME )!=null);
}
}