Search code examples
javamysqlpublic-keyprivate-keydsa

Storage of private and public key in MySQL-DB


Probably somebody asked that already, but I couldn't find any usefull information and I've never done it before.

So here is the problem.

If I'll get a set of key pairs (DSA public and private keys) with different time validity and unique ID, what is the best way to store them in MySQL-DB using Java?

Is it a good idea at all to store them in DB?

Thank you in advance.

Mur

Ps. another problem, i cann't really imagine, how do the both keys look like? just byte arrays?


Solution

  • Your best bet is to use blobs when storing them.

    The decision of whether or not it's a good idea to store the keys in the database depends on the specifics of your application. I can imagine a secure database dedicated to storing this type of information might work for some situations.