From: Edwin W. <ed...@wo...> - 2006-08-28 18:54:04
|
>> I've looked at the examples, but I can't figure out a way to use a plain >> text private key to sign some text. >> >> I can't use a keystore because the method I'm writing will receive the >> key and the text to be signed as Strings and return another String which >> is the signed text. >> >> Could someone point me in the right direction? I just need the Classes to >> use and I should be able to figure things out by my self. > > Are KeySpec and SecretKeyFactory what you are looking for? > > See: > http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html#S > ecretFactory Not for OpenPGP. Use something like: ByteArrayInputStream in = new ByteArrayInputStream(keyString.getBytes()); KeyBundleFactory kbf = KeyBundleFactory.getInstance("OpenPGP"); KeyBundle bundle = kbf.generateKeyBundle(in); in.close(); Edwin |