Re: API Documentation volunteers

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers

Douglas de Oliveira Mendes-2
    Some folks and I wish to write code documentation (javadoc style)
for the opensc.  We hope you guys enjoy it and receive joyfully our
patches. :-)

    If you have any more instructions, this is the time to tell us them. ;-)

Douglas

       
       
               
_______________________________________________________
Yahoo! Acesso Gr?tis - Internet r?pida e gr?tis.
Instale o discador agora! http://br.acesso.yahoo.com/
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers [u]

Andreas Jellinghaus-2
On Thursday 14 July 2005 23:23, Douglas de Oliveira Mendes wrote:
>     Some folks and I wish to write code documentation (javadoc style)
> for the opensc.  We hope you guys enjoy it and receive joyfully our
> patches. :-)
>
>     If you have any more instructions, this is the time to tell us them.

Hi Douglas,

your help is very welcome.
but we already have documentation in current svn trunk,
see http://www.opensc.org/opensc/browser/trunk/doc/src/api/
or doc/src/api/ in a svn trunk checkout. so please work with
bert on the documentation.

also you should know: while it is good to have the opensc
api documented for new developers that want to work on
opensc itself, it's use for other projects is discouraged.
rather we suggest to use the generic pkcs11 api, so the
work to add smart card support will not only benefit opensc,
but other projects like musclecard, too.

pkcs11 is a standard, but it is not easy to use that api
directly. we have a new library "libp11" and I would welcome
help to document it and improve it very much. it is a thin
layer on to of pkcs#11 api that should be easier to use than
raw pkcs#11 and while it is shipped with opensc, it is also
independent and can be used with any other pkcs#11 module.

note however that libp11 is work in progress and not set
in stone. work on it might include radical changes (but
I guess they will not happen), but at least you are warned.

also note that most of our documentation is in the wiki,
but there is also the old opensc.xml/html documentation
and the old web pages. any help on moving that content
into the wiki and improving the wiki would be very welcome.

if you have any changes ready for publication, please post
patches for review on this mailing list ("svn diff" or
"diff -ud" style).

Regards, Andreas
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers [u]

Douglas de Oliveira Mendes-2
    Do you have any examples of using libp11? Even the test cases! Examples should be very usefull, I believe.

Douglas

Andreas Jellinghaus [c] escreveu:
On Thursday 14 July 2005 23:23, Douglas de Oliveira Mendes wrote:
  
    Some folks and I wish to write code documentation (javadoc style)
for the opensc.  We hope you guys enjoy it and receive joyfully our
patches. :-)

    If you have any more instructions, this is the time to tell us them.
    

Hi Douglas,

your help is very welcome.
but we already have documentation in current svn trunk,
see http://www.opensc.org/opensc/browser/trunk/doc/src/api/
or doc/src/api/ in a svn trunk checkout. so please work with
bert on the documentation.

also you should know: while it is good to have the opensc
api documented for new developers that want to work on
opensc itself, it's use for other projects is discouraged.
rather we suggest to use the generic pkcs11 api, so the
work to add smart card support will not only benefit opensc,
but other projects like musclecard, too.

pkcs11 is a standard, but it is not easy to use that api
directly. we have a new library "libp11" and I would welcome
help to document it and improve it very much. it is a thin
layer on to of pkcs#11 api that should be easier to use than
raw pkcs#11 and while it is shipped with opensc, it is also
independent and can be used with any other pkcs#11 module.

note however that libp11 is work in progress and not set
in stone. work on it might include radical changes (but
I guess they will not happen), but at least you are warned.

also note that most of our documentation is in the wiki,
but there is also the old opensc.xml/html documentation
and the old web pages. any help on moving that content
into the wiki and improving the wiki would be very welcome.

if you have any changes ready for publication, please post
patches for review on this mailing list ("svn diff" or 
"diff -ud" style).

Regards, Andreas
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel

  

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers [u]

Andreas Jellinghaus-2
On Tuesday 19 July 2005 22:44, Douglas de Oliveira Mendes wrote:
>     Do you have any examples of using libp11? Even the test cases!
> Examples should be very usefull, I believe.
>

a simple example is attached. all it does is get random
data from the smart card.

for a more complex example, see libp11 in http://www.opensc.org/files/contrib/

I will try to write a few more examples.

Andreas

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel

Makefile (134 bytes) Download Attachment
test.c (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers [u]

Douglas de Oliveira Mendes-2
    Your example was very usefull. Would you mind getting us an example
of decrypting using a private key stored at the smartcard?

Thanks!
Douglas

Andreas Jellinghaus [c] escreveu:

>[...]
>
>I will try to write a few more examples.
>
>Andreas
>

#include <stdio.h>
#include <libp11.h>

int main(int argc, char **argv)
{
        PKCS11_CTX *ctx;
        PKCS11_SLOT *slot;
        unsigned char random[10];
        int rc,len;

        ctx = PKCS11_CTX_new();

        /* load pkcs #11 module */
        rc = PKCS11_CTX_load(ctx, "/home/aj/opensc/lib/opensc-pkcs11.so");
        if (rc) {
                fprintf(stderr, "loading pkcs11 engine failed\n");
                rc=1;
                goto nolib;
        }

        /* get first slot with a token */
        slot = PKCS11_find_token(ctx);
        if (!slot || !slot->token) {
                fprintf(stderr, "no token available\n");
                rc=2;
                goto noslot;
        }

        /* get 10 random bytes */
        len=sizeof(random);
        rc = PKCS11_generate_random(slot, random, len);
        if (rc < 0) {
                fprintf(stderr,"generate_random failed: %d\n",rc);
                rc=3;
                goto norandom;
        }

        printf("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
                random[0], random[1], random[2], random[3], random[4],
                random[5], random[6], random[7], random[8], random[9]);

        rc=0;
norandom:
noslot:
        PKCS11_CTX_unload(ctx);
nolib:
        PKCS11_CTX_free(ctx);
        return rc;
}

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: API Documentation volunteers [u]

Douglas de Oliveira Mendes-2
    I was studying a bit more of libp11 and maybe I write myself such example.

Douglas de Oliveira Mendes wrote:
    Your example was very usefull. Would you mind getting us an example
of decrypting using a private key stored at the smartcard?

Thanks!
Douglas

Andreas Jellinghaus [c] escreveu:

  
[...]

I will try to write a few more examples.

Andreas

    

#include <stdio.h> #include <libp11.h> int main(int argc, char **argv) { PKCS11_CTX *ctx; PKCS11_SLOT *slot; unsigned char random[10]; int rc,len; ctx = PKCS11_CTX_new(); /* load pkcs #11 module */ rc = PKCS11_CTX_load(ctx, "/home/aj/opensc/lib/opensc-pkcs11.so"); if (rc) { fprintf(stderr, "loading pkcs11 engine failed\n"); rc=1; goto nolib; } /* get first slot with a token */ slot = PKCS11_find_token(ctx); if (!slot || !slot->token) { fprintf(stderr, "no token available\n"); rc=2; goto noslot; } /* get 10 random bytes */ len=sizeof(random); rc = PKCS11_generate_random(slot, random, len); if (rc < 0) { fprintf(stderr,"generate_random failed: %d\n",rc); rc=3; goto norandom; } printf("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", random[0], random[1], random[2], random[3], random[4], random[5], random[6], random[7], random[8], random[9]); rc=0; norandom: noslot: PKCS11_CTX_unload(ctx); nolib: PKCS11_CTX_free(ctx); return rc; }

_______________________________________________ opensc-devel mailing list [hidden email] http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel