OmniSciDB  2b310ab3b2
 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 95 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 108 of file OmniSciConnection.java.

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

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

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

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

+ Here is the caller graph for this function:


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