4

I'm trying to debug the code mentioned in this question, more specifically, the last line in the following code:

        // client credentials
        KeyStore keyStore = null;

        keyStore = KeyStore.getInstance("PKCS12", "BC");
        keyStore.load(null, null);
        keyStore.setKeyEntry(CryptographyUtils.CLIENT_NAME, endCredential.getPrivateKey(), CryptographyUtils.CLIENT_PASSWORD,
                new Certificate[]{endCredential.getCertificate(), interCredential.getCertificate(), rootCredential.getCertificate()});
        keyStore.store(new FileOutputStream(CryptographyUtils.CLIENT_NAME + ".p12"), CryptographyUtils.CLIENT_PASSWORD);

Going to the declaration of .store() (using Ctrl + B) opens a file KeyStore.java:

public final void store(OutputStream stream, char[] password)
        throws KeyStoreException, IOException, NoSuchAlgorithmException,
            CertificateException
    {
        if (!initialized) {
            throw new KeyStoreException("Uninitialized keystore");
        }
        keyStoreSpi.engineStore(stream, password);
    }

The last call .engineStore() actually writes the certificates to an output stream. Going to the implementation of the method (Ctrl + Alt + B) the following options are shown:

store keys

The package imported containing the method in my code is from:

import java.security.KeyStore;

I have put a breakpoint in KeyStore.java and it is reached. However, breakpoints placed in decompiled .class files such as those shown in the picture are not.

How may I debug the .engineStore() method?

Community
  • 1
  • 1
Sebi
  • 4,262
  • 13
  • 60
  • 116
  • 1
    Of course, not what you are looking for: but if the point is to debug a certain method; and breakpoints within that method dont work; why not put a breakpoint on the line that invokes the method; and then do some "step into"? – GhostCat Nov 08 '15 at 16:28
  • I tried stepping into as well as force stepping into. A lot of the classes are implementing containers such as vectors and lists which you are inevitably stepping into. It is easy "to get lost" in the code and loose sight of the scope at which you are debugging. – Sebi Nov 08 '15 at 16:34

1 Answers1

2

You need to attach source files if you want to debug that.You cant debug .class files.

See this post to understand how you can add source code to the library configuration.

Community
  • 1
  • 1
RockAndRoll
  • 2,247
  • 2
  • 16
  • 35