OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ai.heavy.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 58 of file HeavyAIConnection.java.

Member Function Documentation

static S_struct ai.heavy.jdbc.KeyLoader.getDetails_pkcs12 ( String  filename,
String  password 
) throws Exception
inlinestatic

Definition at line 71 of file HeavyAIConnection.java.

References nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}.filename(), and ai.heavy.jdbc.KeyLoader.getX509().

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

+ Here is the call graph for this function:

static String ai.heavy.jdbc.KeyLoader.getX509 ( X509Certificate  cert) throws Exception
inlinestatic

Definition at line 64 of file HeavyAIConnection.java.

Referenced by ai.heavy.jdbc.KeyLoader.getDetails_pkcs12().

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

+ Here is the caller graph for this function:


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