Re: How Java work with PKCS12?

From: Samui (samuicheng_at_yahoo.com.hk)
Date: 07/29/03


Date: 29 Jul 2003 00:24:40 -0700

Hi,

I have tried your codes and add my own codes to get private key.
Is this a right approach?
And how can I get the public key ?

        for(Enumeration enum=ks.aliases(); enum.hasMoreElements();){
                String alias = (String)enum.nextElement();
                System.out.println("@:" + alias);
                if (ks.isKeyEntry(alias)){
                        System.out.println("return PrivateKey");
                        return (PrivateKey)ks.getKey(alias, password);
                }
        }

"Didi" <didi1976NO@SPAMgmx.net> wrote in message news:<bg3i4c$672$1@paperboy.Austria.EU.net>...
> Hi,
>
> you can access a PKCS12-File directly from Java.
>
> java.security.KeyStore ks = java.security.KeyStore.getInstance("PKCS12");
> ks.load(new
> java.io.FileInputStream("yourStore.p12"),"yourPassword".toCharArray());
>
> Didi
>
>
> "Samui" <samuicheng@yahoo.com.hk> schrieb im Newsbeitrag
> news:978c0c78.0307232208.a66f8f2@posting.google.com...
> > Hi,
> > I'm a beginner of Java security.
> > Is it possible to get Public Key and Private Key from a PKCS12
> > certificate by Java program?
> > How can I do it?
> > Is there any sample codes or tutorial?
> >
> > Thanks!
> >
> > Samui



Relevant Pages

  • Re: Mars Rover Controlled By Java
    ... >> scale computations, my Java codes perform identical to Fortran codes, ... available in Java nor in Hotspot. ... > I consider a reasonably well-written F95 program to be very maintainable ... between compilers, both of which had different ideas how the standard ...
    (comp.lang.java)
  • Re: Mars Rover Controlled By Java
    ... >> scale computations, my Java codes perform identical to Fortran codes, ... available in Java nor in Hotspot. ... > I consider a reasonably well-written F95 program to be very maintainable ... between compilers, both of which had different ideas how the standard ...
    (comp.programming)
  • Re: Mars Rover Controlled By Java
    ... >> scale computations, my Java codes perform identical to Fortran codes, ... available in Java nor in Hotspot. ... > I consider a reasonably well-written F95 program to be very maintainable ... between compilers, both of which had different ideas how the standard ...
    (comp.lang.java.programmer)
  • Re: Mars Rover Controlled By Java
    ... >> scale computations, my Java codes perform identical to Fortran codes, ... available in Java nor in Hotspot. ... > I consider a reasonably well-written F95 program to be very maintainable ... between compilers, both of which had different ideas how the standard ...
    (comp.theory)
  • Re: Mars Rover Controlled By Java
    ... >> scale computations, my Java codes perform identical to Fortran codes, ... available in Java nor in Hotspot. ... > I consider a reasonably well-written F95 program to be very maintainable ... between compilers, both of which had different ideas how the standard ...
    (comp.object)