I am trying to load a key from the key store and have the following code below-
<Cfscript>
storePath = "c:\coldfusion8\runtime\jre\lib\security\cacerts" ;
ksFile = CreateObject("java", "java.io.File").init(storepath);
inputStream = CreateObject("java", "java.io.FileInputStream").init(ksFile);
keyStoreClass = CreateObject("Java", "java.security.KeyStore");        
ks = keyStoreClass.getInstance("JKS"); 
ks.load(inputStream, JavaCast("string", "changeit").toCharArray() ); 
ks.getKey("product", JavaCast("string", "keyPwd").toCharArray()) ;

signature = CreateObject("java", "java.security.Signature");
signature = signature.getInstance("SHA256withRSA");
signature.initSign( ks.getKey("product", JavaCast("string", 
"keyPwd").toCharArray()) );
</cfscript>

I am getting the error on "initSign". Now looking at the Java Code that I have, 
it's setting the key to privateKey and than passing to initSign method.
<!--- Begin Java Code --->
import java.security.PrivateKey;
PrivateKey key = (PrivateKey) store.getKey("product", "keyPwd".toCharArray());
<!---End Java Code --->

How can I use CF to cast between complex objects? I was hoping something like 
JavaCast but obviously that wont work here.

Thoughts? 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346945
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to