I want to use a smart card (or USB cryptotoken) with a PKI certificate for manual authorisation. Is this possible?

I want to put a file (e.g. a word file or even a simple text file) into a smart card. I also want to put a PKI certificate into the smart card. I issue this smart card to a user. The text file or word document spells out the rights of the user. The user hands the card to someone who can get the file from the smart card and read it. The person to whom he has handed the smartcard has my (issuer's) certificate in his trust store, so the person can verify if this certificate is to be trusted or not. Is this trust transferable? i.e. can the person assume that the document has also come from me & is not tampered?

EDIT: Alternately, can I use some field in the cert itself to put text information - this makes sure that the data cannot be tampered. Is there any field in a X.509 cert where, say, 10 lines of text info can be added when generating the cert?

  • Why cards? Why not digitally sign the file with the issuer's certificate? Why not store the rights file in a central location? How do you propose to revoke rights if the file only exists on a physical card? I feel like you're only telling half the story.
    – schroeder
    Apr 10, 2014 at 15:18
  • Also, do you mean to ask "can I use a smart card as a secure data storage device?"
    – schroeder
    Apr 10, 2014 at 15:24

3 Answers 3


Yes, this is from what i can tell, possible. In X509 you can use the SAN (Subject alternative name) value to specify free metadata for instance, if it's a username, a passphrase, you name it.

This is used widely in enterprise solutions for personal authentication, it can be integrated with a SCEP server for more ease of use.

  • I tried with openssl, it only accepts stuff like DNS or IP in subjectAltName not any text I want.
    – user93353
    Apr 12, 2014 at 5:19
  • But you are going to use it for pAuth, not SSL no? I have not worked with PKI in Linux, but in the microserf world there is alot of different tools for generating csr. One built-in tool is makecert which i've used to specify freetext SAN values for my certificates for personal auth.
    – Neophyte
    Apr 14, 2014 at 6:25
  • I'll try that out. One more question. Do you know if there is a limit on the length of the SAN field?
    – user93353
    Apr 14, 2014 at 10:09
  • sorry for the delayed response, I have yet to encounter any limitations. It is possible to use more than one SAN field. Best of luck!
    – Neophyte
    Apr 22, 2014 at 9:49

You are trying to do authorization with a physical device meant for authentication. This rarely works well.

A smart card is used to authenticate the user, in that it contains a private key which remains under exclusive use of the owner. The certificate is a method by which the link between the public key and the owner's identity are distributed; it is signed by a CA so that the physical medium by which this link information is transferred does not matter; and, in practice, the certificate is also stored on the card because the certificate is most useful when the card is used, so that's a nice emplacement. However, the certificate could also be distributed through some other means, e.g. a big public LDAP server (historically, X.509 certificates were designed to be distributed that way).

None of that tells anybody what a key owner is allowed to do; it only gives some guarantee about the identity of that person (not "what", but "who").

In a given system, once you have ascertained the identity of the requester (that's the authentication part), you have to decide whether the received request should be granted. That second part is called authorization. The really important points here are the following:

  • Authorization information must be amenable to quick modifications, with a shorter granularity than the typical hours of latency of certificate revocation.
  • Authorization information is not necessarily defined by the same people/entities who verify identities; i.e., the job of the CA does not naturally include rights management.
  • Authorization information is sometimes negative so a key owner might not necessarily be trusted for transporting the information which qualifies himself (because the key owner may omit a "rights file" which pinpoints him as an undesirable individual).

For these reasons, what you are trying to do looks like a bad idea. However, being bad never prevented an idea from being standardized. I never saw a situation where "attribute certificates" were really put to good use, though.

On a more incidental plane, usual smart cards cannot embed a lot of public data. A 2 kB certificate is OK, but a 300 kB Word file won't fit.

  • because the key owner may omit a "rights file" which pinpoints him as an undesirable individual - this is what is my question about. Is there a way by which the smartcard prevents tampering of the file attached to the smartcard without resetting the whole card?
    – user93353
    Apr 7, 2014 at 14:11
  • I am OK with embedding a 1 KB text file as long as there is a way of making sure it cannot be tampered.
    – user93353
    Apr 7, 2014 at 14:12

I wonder if I'm missing something, but why does the text file have to reside on the smart card?

If your objective is to provide proof of user authority in the form of a signed document, whoever is "authorizing" the user should sign the file with their cert. (Sure, their private key can reside on a smart card if that is how it's issued, but the smart card does not need to be presented along with the file).

The signed file can then be transferred to any media, and the signature verified by anyone with the corresponding CA certs.

In your scenario, the user being evaluated doesn't need to provide anything except the digitally signed document (perhaps with a photo embedded, or some other means to prove that they are the person referred to).

  • The person will not be carrying any media other than the smart card. Also, signature verification needs some kind of client (which does the verification) to be installed on the person's computer who is verifying the doc. OTOH, certificate verification can be done by Windows OS itself.
    – user93353
    Apr 7, 2014 at 8:02
  • 2
    Perhaps you could elaborate on your use case? How can anyone suggest a better option if you don't state which parameters of your use case are flexible? Apr 7, 2014 at 8:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .