OmniSciDB  85c2d10cdc
 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

Author
michael

Definition at line 62 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 75 of file OmniSciConnection.java.

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

76  {
77  S_struct s_struct = new S_struct();
78  try {
79  KeyStore keystore = KeyStore.getInstance("PKCS12");
80  java.io.FileInputStream fis = new java.io.FileInputStream(filename);
81  keystore.load(fis, password.toCharArray());
82  String alias = null;
83  Enumeration<String> eE = keystore.aliases();
84  int count = 0;
85  while (eE.hasMoreElements()) {
86  alias = eE.nextElement();
87  count++;
88  }
89  if (count != 1) {
90  throw new SQLException("pkcs12 file [" + filename
91  + "] contains an incorrect number [" + count
92  + "] of certificate(s); only a single certificate is allowed");
93  }
94 
95  X509Certificate cert = (X509Certificate) keystore.getCertificate(alias);
96  s_struct.cert = getX509(cert);
97  s_struct.key = keystore.getKey(alias, password.toCharArray());
98  } catch (Exception eX) {
99  OmniSciConnection.logger.error(eX.getMessage());
100  throw eX;
101  }
102  return s_struct;
103  }
std::string filename(char const *path)
Definition: Logger.cpp:62
static String getX509(X509Certificate cert)
int count

+ Here is the call graph for this function:

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

Definition at line 68 of file OmniSciConnection.java.

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

68  {
69  String encoded = Base64.getMimeEncoder().encodeToString(cert.getEncoded());
70  // Note mimeEncoder inserts \r\n in the text - the server is okay with that.
71  encoded = X509Factory.BEGIN_CERT + "\n" + encoded + "\n" + X509Factory.END_CERT;
72  return encoded;
73  }

+ Here is the caller graph for this function:


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