title: Use of ECC in Java SE 1.7
body: <p>I am trying to run the code in this <a href="http://www.academicpub.org/DownLoadPaper.aspx?paperid=14496" rel="nofollow">pdf</a>. For example, for ECCKeyGeneration, I get the following output instead of Figure 1 in the pdf:</p>
  
  <pre><code>sun.security.ec.ECPrivateKeyImpl@58b6
  Sun EC public key, 192 bits
    public x coord: 4812174841545539052388802454891896756539688756781766645984
    public y coord: 1161396487043052042009627836016170768650083444786081272028
    parameters: secp192r1 [NIST P-192, X9.62 prime192v1] (1.2.840.10045.3.1.1)
  </code></pre>
  
  <p>The private key doesn't printed to console/screen. Instead, it says "sun.security.ec.ECPrivateKeyImpl@blabla" as you can see above. What could be the reason for this situation?</p>
  
  <p>Here is the code if you like to test:</p>
  
  <pre><code>import java.security.*;
  import java.security.spec.*;
  
  public class ECCKeyGeneration {
  
      public static void main(String[] args) throws Exception {
          KeyPairGenerator kpg;
          kpg = KeyPairGenerator.getInstance("EC","SunEC");
          ECGenParameterSpec ecsp;
          ecsp = new ECGenParameterSpec("secp192r1");
          kpg.initialize(ecsp);
  
          KeyPair kp = kpg.genKeyPair();
          PrivateKey privKey = kp.getPrivate();
          PublicKey pubKey = kp.getPublic();
  
          System.out.println(privKey.toString());
          System.out.println(pubKey.toString());
      }
  
  }
  </code></pre>