Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Issues with extracting the private key from keystore

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Issues with extracting the private key from keystore

    I need to configure an SSO using digital certificate between the client portal and a third party.To configure the SSO I have received the public key of the third party and able to access it from server location.Now I have to access priavte key of the client to sign it.I have created an abstract portal component and written the below code to fetch the Priavte key from my project folder.I have the certificate in project folder,after acessing the file from project it gives the below error.



    String fielPath1 = request.getPublicResourcePath()+"/SAPLogonTicketKeypair-cert1.cer";
    FileInputStream ksfis = new FileInputStream(fielPath1);
    KeyStore ks = KeyStore.getInstance("JKS");
    ks.load(null, sPass.toCharArray());
    response.write(" Private key store type"+ ks);
    response.write(" ksfis "+ ksfis);
    BufferedInputStream ksbufin = new BufferedInputStream(ksfis);
    response.write(" ksbufin"+ ksbufin);
    ks.load(ksbufin, sPass.toCharArray());
    PrivateKey priv = (PrivateKey) ks.getKey(alias, kPass.toCharArray());
    response.write(" Private key access"+ priv);


    I get the below error:


    Error Invalid keystore formatsun.security.provider.JavaKeyStore.engineLoa d(JavaKeyStore.java:633)sun.security.provider.Java KeyStore$JKS.engineLoad(JavaKeyStore.java:38)java. security.KeyStore.load(KeyStore.java:1185)am_sso_a pc.doContent(am_sso_apc.java:132)com.sapportals.po rtal.prt.component.AbstractPortalComponent.service Deprecated(AbstractPortalComponent.java:213)



    Please let me know how to pass the filepath to extract the priavte key from the server itself.



    Thanks

    Nisha


  2. #2
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Issues with extracting the private key from keystore

    Any replies on the above issues ???????????
    Anyone can help me ?Its critical actually

  3. #3
    Member
    Join Date
    Feb 2013
    Location
    earth
    Posts
    88
    Thanks
    12
    Thanked 9 Times in 9 Posts

    Default Re: Issues with extracting the private key from keystore

    G

Similar Threads

  1. Issues with extracting the private key from keystore
    By nisha27 in forum Member Introductions
    Replies: 0
    Last Post: February 21st, 2013, 03:28 AM
  2. [SOLVED] restricting a particular key stroke or key code
    By chronoz13 in forum AWT / Java Swing
    Replies: 2
    Last Post: April 22nd, 2011, 12:19 PM
  3. KeyStore.getInstance("Windows-MY") : Equivalent on Linux plateform ?
    By Nicolas74100 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 14th, 2010, 03:49 PM
  4. Convert string to private and public key
    By Ganezan in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: January 5th, 2010, 08:37 AM