OmniSciDB  bf83d84833
 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 96 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 109 of file OmniSciConnection.java.

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

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

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

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

+ Here is the caller graph for this function:


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