test_class.declarator: CA_CERT_SUBJECT_DN_CN = "CN=ca.test.jolokia.org"
test_class.modifier: public static final
test_class.original_string: public static final String CA_CERT_SUBJECT_DN_CN = "CN=ca.test.jolokia.org";
test_class.type: String
test_class.var_name: CA_CERT_SUBJECT_DN_CN
test_class.declarator: SERVER_CERT_SUBJECT_DN = "CN=Server Cert signed and with extended key usage server, C=DE, ST=Franconia, L=Pegnitz, OU=Test, O=jolokia.org"
test_class.modifier: public static final
test_class.original_string: public static final String SERVER_CERT_SUBJECT_DN = "CN=Server Cert signed and with extended key usage server, C=DE, ST=Franconia, L=Pegnitz, OU=Test, O=jolokia.org";
test_class.type: String
test_class.var_name: SERVER_CERT_SUBJECT_DN
test_class.declarator: CA_ALIAS = "cn=ca.test.jolokia.org,c=de,st=bavaria,l=pegnitz,1.2.840.113549.1.9.1=#1612726f6c616e64406a6f6c6f6b69612e6f7267,ou=dev,o=jolokia"
test_class.modifier: public static final
test_class.original_string: public static final String CA_ALIAS = "cn=ca.test.jolokia.org,c=de,st=bavaria,l=pegnitz,1.2.840.113549.1.9.1=#1612726f6c616e64406a6f6c6f6b69612e6f7267,ou=dev,o=jolokia";
test_class.type: String
test_class.var_name: CA_ALIAS
test_class.declarator: SERVER_ALIAS = "cn=server cert signed and with extended key usage server,c=de,st=franconia,l=pegnitz,ou=test,o=jolokia.org"
test_class.modifier: public static final
test_class.original_string: public static final String SERVER_ALIAS = "cn=server cert signed and with extended key usage server,c=de,st=franconia,l=pegnitz,ou=test,o=jolokia.org";
test_class.type: String
test_class.var_name: SERVER_ALIAS
test_class.file: agent/jvm/src/test/java/org/jolokia/jvmagent/security/KeyStoreUtilTest.java
test_class.identifier: KeyStoreUtilTest
test_case.body: @Test
      public void testSelfSignedCertificate() throws Exception {
          KeyStore keystore = createKeyStore();
          KeyStoreUtil.updateWithSelfSignedServerCertificate(keystore);
          X509Certificate cert = (X509Certificate) keystore.getCertificate("jolokia-agent");
          assertNotNull(cert);
          assertEquals(cert.getSubjectDN().getName(), "CN=Jolokia Agent " + Version.getAgentVersion() + ", OU=JVM, O=jolokia.org, L=Pegnitz, ST=Franconia, C=DE");
          assertEquals(cert.getSubjectDN(), cert.getIssuerDN());
      }
test_case.class_method_signature: KeyStoreUtilTest.testSelfSignedCertificate()
test_case.full_signature: @Test public void testSelfSignedCertificate()
test_case.identifier: testSelfSignedCertificate
test_case.invocations: createKeyStore updateWithSelfSignedServerCertificate getCertificate assertNotNull assertEquals getName getSubjectDN getAgentVersion assertEquals getSubjectDN getIssuerDN
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSelfSignedCertificate()
focal_class.declarator: KEYGEN_CLASS_JDK8_SUN = "sun.security.tools.keytool.CertAndKeyGen"
focal_class.modifier: private static final
focal_class.original_string: private static final String KEYGEN_CLASS_JDK8_SUN = "sun.security.tools.keytool.CertAndKeyGen";
focal_class.type: String
focal_class.var_name: KEYGEN_CLASS_JDK8_SUN
focal_class.declarator: KEYGEN_CLASS_JDK7_SUN = "sun.security.x509.CertAndKeyGen"
focal_class.modifier: private static final
focal_class.original_string: private static final String KEYGEN_CLASS_JDK7_SUN = "sun.security.x509.CertAndKeyGen";
focal_class.type: String
focal_class.var_name: KEYGEN_CLASS_JDK7_SUN
focal_class.declarator: KEYGEN_CLASS_JDK8_IBM = "com.ibm.security.tools.CertAndKeyGen"
focal_class.modifier: private static final
focal_class.original_string: private static final String KEYGEN_CLASS_JDK8_IBM = "com.ibm.security.tools.CertAndKeyGen";
focal_class.type: String
focal_class.var_name: KEYGEN_CLASS_JDK8_IBM
focal_class.declarator: KEYGEN_CLASS_JDK7_IBM = "com.ibm.security.x509.CertAndKeyGen"
focal_class.modifier: private static final
focal_class.original_string: private static final String KEYGEN_CLASS_JDK7_IBM = "com.ibm.security.x509.CertAndKeyGen";
focal_class.type: String
focal_class.var_name: KEYGEN_CLASS_JDK7_IBM
focal_class.declarator: X500_NAME_SUN = "sun.security.x509.X500Name"
focal_class.modifier: private static final
focal_class.original_string: private static final String X500_NAME_SUN = "sun.security.x509.X500Name";
focal_class.type: String
focal_class.var_name: X500_NAME_SUN
focal_class.declarator: X500_NAME_IBM = "com.ibm.security.x509.X500Name"
focal_class.modifier: private static final
focal_class.original_string: private static final String X500_NAME_IBM = "com.ibm.security.x509.X500Name";
focal_class.type: String
focal_class.var_name: X500_NAME_IBM
focal_class.file: agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java
focal_class.identifier: KeyStoreUtil
focal_class.class_method_signature: KeyStoreUtil.KeyStoreUtil()
focal_class.full_signature: private  KeyStoreUtil()
focal_class.identifier: KeyStoreUtil
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  KeyStoreUtil()
focal_class.class_method_signature: KeyStoreUtil.updateWithCaPem(KeyStore pTrustStore, File pCaCert)
focal_class.full_signature: public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert)
focal_class.identifier: updateWithCaPem
focal_class.modifiers: public static
focal_class.parameters: (KeyStore pTrustStore, File pCaCert)
focal_class.return: void
focal_class.signature: void updateWithCaPem(KeyStore pTrustStore, File pCaCert)
focal_class.class_method_signature: KeyStoreUtil.updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword)
focal_class.full_signature: public static void updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword)
focal_class.identifier: updateWithServerPems
focal_class.modifiers: public static
focal_class.parameters: (KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword)
focal_class.return: void
focal_class.signature: void updateWithServerPems(KeyStore pKeyStore, File pServerCert, File pServerKey, String pKeyAlgo, char[] pPassword)
focal_class.class_method_signature: KeyStoreUtil.updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
focal_class.full_signature: public static void updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
focal_class.identifier: updateWithSelfSignedServerCertificate
focal_class.modifiers: public static
focal_class.parameters: (KeyStore pKeyStore)
focal_class.return: void
focal_class.signature: void updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
focal_class.class_method_signature: KeyStoreUtil.createKeyPair()
focal_class.full_signature: private static Object createKeyPair()
focal_class.identifier: createKeyPair
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: Object
focal_class.signature: Object createKeyPair()
focal_class.class_method_signature: KeyStoreUtil.getSelfCertificate(Object keypair, Object x500Name, Date date, long l)
focal_class.full_signature: private static X509Certificate getSelfCertificate(Object keypair, Object x500Name, Date date, long l)
focal_class.identifier: getSelfCertificate
focal_class.modifiers: private static
focal_class.parameters: (Object keypair, Object x500Name, Date date, long l)
focal_class.return: X509Certificate
focal_class.signature: X509Certificate getSelfCertificate(Object keypair, Object x500Name, Date date, long l)
focal_class.class_method_signature: KeyStoreUtil.getPrivateKey(Object keypair)
focal_class.full_signature: private static PrivateKey getPrivateKey(Object keypair)
focal_class.identifier: getPrivateKey
focal_class.modifiers: private static
focal_class.parameters: (Object keypair)
focal_class.return: PrivateKey
focal_class.signature: PrivateKey getPrivateKey(Object keypair)
focal_class.class_method_signature: KeyStoreUtil.lookupKeyGenClass()
focal_class.full_signature: private static Class lookupKeyGenClass()
focal_class.identifier: lookupKeyGenClass
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: Class
focal_class.signature: Class lookupKeyGenClass()
focal_class.class_method_signature: KeyStoreUtil.decodePem(File pemFile)
focal_class.full_signature: private static byte[] decodePem(File pemFile)
focal_class.identifier: decodePem
focal_class.modifiers: private static
focal_class.parameters: (File pemFile)
focal_class.return: byte[]
focal_class.signature: byte[] decodePem(File pemFile)
focal_class.class_method_signature: KeyStoreUtil.readBytes(File pemFile, BufferedReader reader, String endMarker)
focal_class.full_signature: private static byte[] readBytes(File pemFile, BufferedReader reader, String endMarker)
focal_class.identifier: readBytes
focal_class.modifiers: private static
focal_class.parameters: (File pemFile, BufferedReader reader, String endMarker)
focal_class.return: byte[]
focal_class.signature: byte[] readBytes(File pemFile, BufferedReader reader, String endMarker)
focal_method.body: public static void updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
              throws NoSuchProviderException, NoSuchAlgorithmException, IOException,
                     InvalidKeyException, CertificateException, SignatureException, KeyStoreException {
  
          final Object x500Name;
          final Object[] certAttributes = { "Jolokia Agent " + Version.getAgentVersion(), // CN
                                            "JVM",                                        // OU
                                            "jolokia.org",                                // O
                                            "Pegnitz",                                    // L
                                            "Franconia",                                  // ST
                                            "DE" };
          if (ClassUtil.checkForClass(X500_NAME_SUN)) {
              x500Name = ClassUtil.newInstance(X500_NAME_SUN, certAttributes);
          } else if (ClassUtil.checkForClass(X500_NAME_IBM)) {
              x500Name = ClassUtil.newInstance(X500_NAME_IBM, certAttributes);
          } else {
              throw new IllegalStateException("Neither Sun- nor IBM-style JVM found.");
          }
  
          // Need to do it via reflection because Java8 moved class to a different package
          Object keypair = createKeyPair();
          PrivateKey privKey = getPrivateKey(keypair);
  
          X509Certificate[] chain = new X509Certificate[1];
          chain[0] = getSelfCertificate(keypair, x500Name, new Date(), (long) 3650 * 24 * 60 * 60);
          pKeyStore.setKeyEntry("jolokia-agent", privKey, new char[0], chain);
      }
focal_method.class_method_signature: KeyStoreUtil.updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
focal_method.full_signature: public static void updateWithSelfSignedServerCertificate(KeyStore pKeyStore)
focal_method.identifier: updateWithSelfSignedServerCertificate
focal_method.invocations: getAgentVersion checkForClass newInstance checkForClass newInstance createKeyPair getPrivateKey getSelfCertificate setKeyEntry
focal_method.modifiers: public static
focal_method.parameters: (KeyStore pKeyStore)
focal_method.return: void
focal_method.signature: void updateWithSelfSignedServerCertificate(KeyStore pKeyStore)