Javacard applet and client application - Java

This is a discussion on Javacard applet and client application - Java ; Hi. I'm developing a Javacard applet for digital signature. I also have to write a client to verify the signatures (RSA_SHA_PKCS1). I think I managed to code the applet, but i'm very confused about the standard java part of the ...

+ Reply to Thread
Results 1 to 3 of 3

Javacard applet and client application

  1. Default Javacard applet and client application

    Hi.

    I'm developing a Javacard applet for digital signature. I also have to
    write a client to verify the signatures (RSA_SHA_PKCS1).

    I think I managed to code the applet, but i'm very confused about the
    standard java part of the work: from the applet I can generate a keypair
    and get the public key, in form of 2 byte[] for the modulus and the
    exponent.

    - How can I rebuild a PublicKey object to verify the signature ???

    - Is there a standard way to write the key to a file for a later use ???


    Thanks in advance,

    Nic :-)

  2. Default Re: Javacard applet and client application

    try someting like

    RSAPublicKeySpec keySpec =
    new RSAPublicKeySpec(new BigInteger(1, modulus), new new BigInteger(1,
    exponent));

    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    PublicKey publicKey = keyFactory.generatePublic(keySpec);

    to get a public key for signature verification using the Signature class.

    byte[] encodedKey = publicKey.getEncoded();

    to get the key in an (X.509) encoded form for writing it to a file.
    use

    X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encodedKey);

    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    PublicKey publicKey = keyFactory.generatePublic(keySpec);

    to create a public key from its encoded form again.

    Karl

    --

    Karl Scheibelhofer, IAIK - Graz University of Technology
    Inffeldgasse 16a, 8010 Graz, Austria
    Fax: +43 316 873 5520
    http://jce.iaik.tugraz.at/


    "Nicholas" <nico282@hotmail.com> wrote in message
    news:1gja0fz.hckfguqq3g5cN%nico282@hotmail.com...
    > Hi.
    >
    > I'm developing a Javacard applet for digital signature. I also have to
    > write a client to verify the signatures (RSA_SHA_PKCS1).
    >
    > I think I managed to code the applet, but i'm very confused about the
    > standard java part of the work: from the applet I can generate a keypair
    > and get the public key, in form of 2 byte[] for the modulus and the
    > exponent.
    >
    > - How can I rebuild a PublicKey object to verify the signature ???
    >
    > - Is there a standard way to write the key to a file for a later use ???
    >
    >
    > Thanks in advance,
    >
    > Nic :-)




  3. Default Re: Javacard applet and client application

    Karl, thank you very much for you help. It was precious to me !!!!! You
    saved me a lot of time investigating for the right classes and methods
    !!! :-D

    Now my application can sign data with a Javacard, and verify the
    signature with the exported public key.

    Again, thanks :-)

    Nicholas


    Karl Scheibelhofer <karl.scheibelhofer@iaik.tugraz.at> wrote:

    > try someting like
    >
    > RSAPublicKeySpec keySpec =
    > new RSAPublicKeySpec(new BigInteger(1, modulus), new new BigInteger(1,
    > exponent));
    >
    > KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    > PublicKey publicKey = keyFactory.generatePublic(keySpec);
    >
    > to get a public key for signature verification using the Signature class.
    >
    > byte[] encodedKey = publicKey.getEncoded();
    >
    > to get the key in an (X.509) encoded form for writing it to a file.
    > use
    >
    > X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encodedKey);
    >
    > KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    > PublicKey publicKey = keyFactory.generatePublic(keySpec);
    >
    > to create a public key from its encoded form again.


+ Reply to Thread

Similar Threads

  1. JMF Applet without client side installation
    By Application Development in forum Java
    Replies: 20
    Last Post: 10-20-2009, 11:41 PM
  2. IRC chat client that is not an applet, or html based.
    By Application Development in forum Java
    Replies: 2
    Last Post: 12-05-2007, 06:38 PM
  3. JMF and client side Applet problem
    By Application Development in forum Java
    Replies: 1
    Last Post: 07-28-2007, 02:59 AM
  4. implementing typeof() in javacard
    By Application Development in forum Java
    Replies: 0
    Last Post: 05-13-2004, 09:42 AM
  5. Replies: 0
    Last Post: 10-08-2003, 11:15 AM