Gareth
12/13/2022, 11:50 PMGary Corcoran
12/14/2022, 12:03 PMSlackbot
12/14/2022, 1:15 PMdavla
12/14/2022, 3:27 PM<cfscript>
writeOutput('hello world');
</cfscript>
I was originally trying some slightly more advanced code and the syntax errors wouldn’t go away. So tried the above as the simplest line of code - but still seeing:
There was an error parsing your code. This usually indicates a missing ; or another compile time syntax error. Check your syntax and try again.
All working on Lucee 4.5 engine. Guessing I have a bad Lucee 5 instance.pmascaricfml
12/15/2022, 8:01 PMWilzDezign
12/16/2022, 9:14 AMdavla
12/16/2022, 1:21 PMaPartners = [
{
"partnerid":1,
"partnername": "Partner 1",
"partnercode": "pt1",
...
"configsettings: {
...
}
},
{
"partnerid":2,
"partnername": "Partner 2",
"partnercode": "pt2",
...
"configsettings: {
...
}
}
];
allowedKeys = ["partnername","partnercode"];
How to process the above (arrayReduce/Map etc) to produce an array of structs with just partnername and partnercode in each struct. I tried this but it doesn’t work as needed:
allowedKeys = ["partnername","partnercode"];
for(partner IN aPartners) {
objKeys = structKeyArray(partner);
result = objKeys.reduce(function(accumulator, ele) {
if( allowedKeys.findNoCase(ele) ) {
obj = {
"#ele#": partner[ele]
};
return accumulator.append(obj);
} else {
return accumulator;
}
}, []);
};
What should I be using?Dave Merrill
12/16/2022, 1:47 PMDave Merrill
12/16/2022, 1:47 PMUmair Khan
12/16/2022, 6:02 PMpmascaricfml
12/16/2022, 8:12 PM[ivLength: 1 byte][iv][aadLength: 2 bytes][aad][cipherTextLength: 4 bytes][cipherText][tag: 16 bytes]
Thus, to parse the initialization vector (iv), you would read the first byte of the sequence to get its length. Then, you would read the next n bytes in the sequence to get the actual value of iv. To get the aad, you would read the 2 bytes following the iv to get its length, and then the next m bytes in the sequence to get the aad value. The tag at the end of the sequence has a predetermined length of 16 bytes, so its length is not included."
I have had many stops and starts but I am having all kinds of trouble figuring this out. I've poured over many articles from Ben Nadel and others. Here's one of many of my several tries... Hoping someone can point me in the right direction.
I have no idea if I'm on the right path or not, but the "aad" errors saying the array is out of bounds.
<cfset context = myEncryptedString>
<cfset contextByte = createObject("Java", "java.lang.String").init(JavaCast("string", context).getBytes())>
<cfset b64 = createObject("Java", "org.apache.commons.codec.binary.Base64").init().decodeBase64(contextByte)>
<cfset in = createObject("Java", "java.io.ByteArrayInputStream").init(b64)>
<cfset strt = 1>
<!--- parse the initialization vector (iv), you would read the first byte of the sequence to get its length --->
<cfset test = binarySlice( b64, strt, 1 )>
<cfset ivLength = createObject("Java", "java.io.ByteArrayInputStream").init(test).read()>
<cfdump var="#ivLength#" label="ivLength"><br><hr>
<!--- Then, you would read the next n bytes in the sequence to get the actual value of iv --->
<cfset strt = 2>
<cfset iv = binarySlice( b64, strt, ivLength)>
<cfset iv = createObject("Java", "java.io.ByteArrayInputStream").init(iv).read()>
<cfdump var="#iv#" label="iv"><br><hr>
<!--- To get the aad, you would read the 2 bytes following the iv to get its length --->
<cfset strt = 3+iv>
<cfset aadlen = binarySlice( b64, strt, 2)>
<cfset aadlen = createObject("Java", "java.io.ByteArrayInputStream").init(aadlen).read()>
<cfdump var="#aadlen#" label="aadlen"><br><hr>
<!--- then the next m bytes in the sequence to get the aad value --->
<!--- <cfset strt = strt+2>
<cfset aad = binarySlice( b64, strt, aadlen)>
<cfset aad = createObject("Java", "java.io.ByteArrayInputStream").init(aad).read()>
<cfdump var="#aad#" label="aad"><br><hr> --->
<!--- tag at the end of the sequence has a predetermined length of 16 bytes, so its length is not included --->
<!--- Thanks, Ben! --->
<cfscript>
public binary function binarySlice(
required binary input,
required numeric index,
numeric length = 0
) {
var result = length
? arraySlice( input, index, length )
: arraySlice( input, index )
;
return( javaCast( "byte[]", result ) );
}
</cfscript>
johnbarrett
12/16/2022, 11:45 PMMauro caresimo
12/19/2022, 12:22 PMpmascaricfml
12/19/2022, 7:45 PMbyte[] values = new byte[5];
I realize I can do something like this
values = javaCast("byte[]", [ 83, 65, 82, 65, 72 ]);
But I need to initial byte array to be empty?gus_dancy
12/19/2022, 10:17 PMphillipsenn
12/20/2022, 9:18 PMphillipsenn
12/20/2022, 9:19 PMphillipsenn
12/20/2022, 9:21 PMrawk
12/20/2022, 11:00 PMgavinbaumanis
12/21/2022, 9:43 AMMinh Nguyen
12/21/2022, 11:24 AMzackster
12/21/2022, 6:38 PMTyler Clendenin
12/22/2022, 2:10 AMDave Merrill
12/22/2022, 7:12 PMa = [];
a[2] = "asdf";
John Liljegren
12/22/2022, 8:02 PMScott Steinbeck
12/23/2022, 12:25 AMbasicAuth = require('btoa')(authConfig.clientId + ':' + authConfig.clientSecret);
....
headers: {
'Accept': 'application/json',
'Authorization': 'Basic ' + basicAuth,
'Content-Type' : 'application/x-www-form-urlencoded'
},
is it just doing a base64
and adding an authorization header. or does this get done automatically if we use the username
and password
args?gsr
12/23/2022, 1:10 PMjava.args=-server -Xms512m -Xmx2048m --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/sun.util.cldr=ALL-UNNAMED --add-opens=java.base/sun.util.locale.provider=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED -XX:+UseParallelGC -Djdk.attach.allowAttachSelf=true -Dcoldfusion.home={application.home} -Duser.language=en -Dcoldfusion.rootDir={application.home} -Dcoldfusion.libPath={application.home}/lib -Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=true -Dcoldfusion.jsafe.defaultalgo=FIPS186Random -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog -Djava.util.logging.config.file={application.home}/lib/logging.properties -Dtika.config=tika-config.xml -Djava.locale.providers=COMPAT,SPI -Dsun.font.layoutengine=icu -Dcom.sun.media.jai.disableMediaLib=true -Dcoldfusion.datemask.useDasdayofmonth=true -Dcoldfusion.classPath={application.home}/lib/updates,{application.home}/lib/,{application.home}/gateway/lib/,{application.home}/wwwroot/WEB-INF/cfform/jars,{application.home}/bin/cf-osgicli.jar
# Comma separated list of shared library path
java.library.path={application.home}/lib,{application.home}/jintegra/bin,{application.home}/jintegra/bin/international
# Comma separated list of shared library path for non-windows
java.nixlibrary.path={application.home}/lib
java.class.path=
i aqm still confused why it ends up in heap, is there a way how i can check what is going on,gavinbaumanis
12/23/2022, 3:16 PMjohnbarrett
12/23/2022, 11:37 PMDaniel Mejia
12/24/2022, 10:06 AM