Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create a public key object

 
bada Bos
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic