OmniSciDB  0bd2ec9cf4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.omnisci.jdbc.KeyLoader Class Reference

Classes

class  S_struct
 

Static Public Member Functions

static String getX509 (X509Certificate cert) throws Exception
 
static S_struct getDetails_pkcs12 (String filename, String password) throws Exception
 

Detailed Description

Definition at line 94 of file OmniSciConnection.java.

Member Function Documentation

static S_struct com.omnisci.jdbc.KeyLoader.getDetails_pkcs12 ( String  filename,
String  password 
) throws Exception
inlinestatic

Definition at line 107 of file OmniSciConnection.java.

References logger.filename(), com.omnisci.jdbc.KeyLoader.getX509(), and Experimental.String.

108  {
109  S_struct s_struct = new S_struct();
110  try {
111  KeyStore keystore = KeyStore.getInstance("PKCS12");
112  java.io.FileInputStream fis = new java.io.FileInputStream(filename);
113  keystore.load(fis, password.toCharArray());
114  String alias = null;
115  Enumeration<String> eE = keystore.aliases();
116  int count = 0;
117  while (eE.hasMoreElements()) {
118  alias = eE.nextElement();
119  count++;
120  }
121  if (count != 1) {
122  throw new RuntimeException("pkcs12 file [" + filename
123  + "] contains an incorrect number [" + count
124  + "] of certificate(s); only a single certificate is allowed");
125  }
126 
127  X509Certificate cert = (X509Certificate) keystore.getCertificate(alias);
128  s_struct.cert = getX509(cert);
129  s_struct.key = keystore.getKey(alias, password.toCharArray());
130  } catch (Exception eX) {
131  OmniSciConnection.logger.error(eX.getMessage());
132  throw eX;
133  }
134  return s_struct;
135  }
std::string filename(char const *path)
Definition: Logger.cpp:58
static String getX509(X509Certificate cert)

+ Here is the call graph for this function:

static String com.omnisci.jdbc.KeyLoader.getX509 ( X509Certificate  cert) throws Exception
inlinestatic

Definition at line 100 of file OmniSciConnection.java.

References Experimental.String.

Referenced by com.omnisci.jdbc.KeyLoader.getDetails_pkcs12().

100  {
101  String encoded = Base64.getMimeEncoder().encodeToString(cert.getEncoded());
102  // Note mimeEncoder inserts \r\n in the text - the server is okay with that.
103  encoded = X509Factory.BEGIN_CERT + "\n" + encoded + "\n" + X509Factory.END_CERT;
104  return encoded;
105  }

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: