Storing Certificates on a database - anything better than serialization?

I'd like to implement a certificate store as a database table (it's a set of locally generated certificates where the private key is issued to authorized users).

The obvious way is to serialize the ceritificates and store them in a VARBInary field but it's unapealingly innefient (fixed overheads on serialiized streams being quite high in this case).

Is there a more structured way?

[405 byte] By [malcolmmca] at [2007-11-27 9:44:08]
# 1
I would store them in a Blob rather than a VARBinary field myself, but why are 'fixed overheads on serialiized streams ... quite high in this case'?
ejpa at 2007-7-12 23:50:32 > top of Java-index,Java Essentials,Java Programming...
# 2

Because serialization puts out stuff like the FQN of each class the first time an object of a given class is serializes, so the size of the stream includes space per class as well as per object. It's thus not a very efficient format when only one or two objects are involved.

Neverthless I doubt it will be big enough to justify using a blob.

malcolmmca at 2007-7-12 23:50:33 > top of Java-index,Java Essentials,Java Programming...
# 3
Use Certificate.getEncoded() and CertificateFactory.generateCertificate(), which is essentially the inverse function.
ejpa at 2007-7-12 23:50:33 > top of Java-index,Java Essentials,Java Programming...