This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes create a public key object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "create a public key object" Watch "create a public key object" New topic
Author

create a public key object

bada Bos
Greenhorn

Joined: Jan 18, 2008
Posts: 2
i'am trying to create a public key object. this is my code :

1- EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(pkbytes);
2- KeyFactory keyFactory = KeyFactory.getInstance("DSA");
2- PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);
3- signAl = Signature.getInstance(SHA1withDSA);

where pkbytes is an array of bytes that i've created from the file that content the public key
but when i execute the programm, i get an this exception
InvalidKeySpecException.Someone has an idea ?
thank you.
 
jQuery in Action, 2nd edition
 
subject: create a public key object
 
Similar Threads
need to generate RSA keys from txt files
string encrypt/decrypt API
unable to read key values from file
problem with RSA..... folks please help!
Playing with KeyPair