encrypting with initialization vectors

2012-05-10 Thread Carol Knapp

I can't seem to get the encrypt function to take an initialization vector. It 
doesn't matter what I put there. It returns the exact same result as if there 
is no initialization vector. 

Is anyone using that? Can you please provide an example where it works?

~|
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:351104
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: encrypting with initialization vectors

2012-05-10 Thread Carol Knapp

Here's the test code. I'll take AES or DESEDE or better. Running cf enterprise.


!--- testenc.cfm   
**  Purpose:test encryption
---
html
headtitleTest ENC/title/head
body style=margin:20px; font-family:Arial, Helvetica, sans-serif; 
font-size:12px; background-color:#f2f0db;
h3Test ENC/h3

!--- Do the following if the form has been submitted. --- 
cfif IsDefined(Form.myString) 
cfscript 
theKey=generateSecretKey(Form.myAlgorithm); 
anotherKey=generateSecretKey(Form.myAlgorithm);
useasiv = 
encryptBinary(anotherkey,theKey,Form.myAlgorithm,Form.myEncoding);

//Encrypt the string. 
encrypted=encrypt(Form.myString, theKey, 
Form.myAlgorithm,Form.myEncoding); 
IVencrypted = encrypt(Form.myString, theKey, 
Form.myAlgorithm,Form.myEncoding,useasiv); 
//Decrypt it. 
decrypted=decrypt(encrypted, theKey, Form.myAlgorithm, 
Form.myEncoding); 
IVdecrypted=decrypt(encrypted, theKey, Form.myAlgorithm, 
Form.myEncoding,useasiv);  
/cfscript 
 
!--- Display the values and the results. --- 
cfoutput 
bThe algorithm:/b #Form.myAlgorithm#br 
br
bThe key:nbsp;nbsp;/B #theKey#br 

br 
bThe string:/b #Form.myString# br 
br 
bEncrypted:nbsp;nbsp;nbsp;/b #encrypted#br 
bIVencrypted:/b #IVencrypted#br
br 
bDecrypted:/b #decrypted#br
bIVecrypted:/b #ivdecrypted#br 
brbr
/cfoutput 
/cfif 

cfparam name=myEncoding default=
cfparam name=myAlgorithm default=
!--- The input form. --- 
form action=cfoutput#CGI.SCRIPT_NAME#/cfoutput method=post 
input type=hidden name=onetimeid 
value=cfoutput#onetimeid#/cfoutput
bSelect the encoding/bbr 
select size=1 name=myEncoding  
option cfif myEncoding IS UUselected/cfifUU/option 
option cfif myEncoding IS Base64selected/cfifBase64/option 
option cfif myEncoding IS Hexselected/cfifHex/option 
/selectbr 
br 
bSelect the algorithm/bbr 
select size=1 name=myAlgorithm  
option cfif myAlgorithm IS AESselected/cfifAES/option 
option cfif myAlgorithm IS DESselected/cfifDES/option 
option cfif myAlgorithm IS DESEDEselected/cfifDESEDE/option 
/selectbr 
br 
bEnter string to encrypt/bbr 
textArea name = myString cols = 40 rows = 2 WRAP = 
VIRTUAL1234567890123456/textArea
input type = Submit value = Encrypt my String 
/form 

~|
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:351106
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: encrypting with initialization vectors

2012-05-10 Thread Carol Knapp

Got it working. Thanks, guys. 

rantI don't get why this kind of information wouldn't be available in the cf9 
reference./rant


 I can't seem to get the encrypt function to take an initialization 
 vector. It doesn't matter what I put there. It returns the exact same 
 result as if there is no initialization vector. 
 
 Is anyone using that? Can you please provide an example where it 
works? 

~|
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:351110
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


autosuggest event with angle brackets

2011-10-10 Thread Carol Knapp

I have a form field that needs to hold firstname lastname emailaddress and 
I would like to use an autosuggest event to make it work. The problem is the 
angle brackets: I can get the autosuggest list to look right if I send it the 
suggested values using lt;/gt; but then it returns the lt;/gt; inside the 
field content. Is there some javascript I can use to replace the returned value 
with the version that uses the real angle brackets? 

Here's the test version of the code I'm using, adapted from the cf docs:

html 
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; 
head 
cfajaximport tags=cfinput-autosuggest 
script 
  var init = function() 
  { 
autosuggestobj = 
ColdFusion.Autosuggest.getAutosuggestObject('nameemail'); 
autosuggestobj.itemSelectEvent.subscribe(foo); 
  } 
  var foo = function(event,args) 
  { 
var msg  = ; 
msg = msg + Event:  + event + \n\n; 
msg = msg + Selected Item:  + args[2] + \n\n; 
msg = msg + Index:  + args[1]._nItemIndex + \n\n; 
var newmsg = msg.replace(lt;,); //just playing w/replace
var newnewmsg = newmsg.replace(gt;,);
alert(newnewmsg); 
  } 
  var getName = function(){ 
return [Joe Smith lt;joesm...@.comgt;,Jane Smythe 
lt;jsmy...@456.comgt; ,Jon Gggg lt;j...@jgjg.netgt;,Clyde Farmer 
lt;clydefar...@z.comgt;,Alka Seltzer 
lt;aselt...@amazzz.comgt;,Pendant Hang lt;ph...@claws.comgt;,Penny Utah 
lt;pu...@zyxwvut.netgt;,Amy Winston lt;awins...@gluggg.orggt;]; 
  } 
/script 
/head 
body
center
h3Attaching an event handler to the autosuggest object/h3 
cfform name=mycfform method=post  
 Name:br /
 cfinput 
type=text 
name=nameemail 
size=40
autosuggest=javascript:getName({cfautosuggestvalue}) 
autosuggestMinLength=1 
autosuggestBindDelay=1 
  ifirst last lt;emailgt;/i
  cfset ajaxOnLoad(init) 
/cfform 
/center
/body 
/html 

~|
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:348037
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: autosuggest event with angle brackets

2011-10-10 Thread Carol Knapp

Edit: well that didn't come through at all clear. What I'm trying to say is 
that I need to pass the and-lt-semi and and-gt-semi (the html format version of 
the less than and greater than signs) inside of the list in order to get the 
autosuggest list to display them as angle brackets, but I don't want 
and-lt-semi and and-gt-semi to appear in the form field returned. 

~|
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:348039
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm