Platform API BES_Signing_Keys Issue

(imported topic written by SystemAdmin)

Hey all,

I have a problem with some code using the platform api. The BES_Signing_Keys works great when used on the machine I programmed the piece of code on, however, when I move my html application to another computer the function AreSigningKeysValid(usernametem, passwordtem) claims they are no longer valid. I am using a share to store the three files so the html application should work anywhere. The code is written in javascript.

var sk = new ActiveXObject(“BESAPI.SigningKeys”);//used to check the TEM credentials of the user

var usernametem = window.prompt("Enter your username for TEM: ", “”);//allows the user to enter their username

while (usernametem == “”) {

usernametem = window.prompt("Enter your username for TEM: ", “”);//makes sure they enter a username

}

sk.SetPrivateKeyPath(usernametem, “\\server\share\publisher.pvk”);

sk.SetPublisherCertPath(usernametem, “\\server\share\publisher.crt”);

sk.SetLicenseCertPath(usernametem, “\\server\share\license.crt”);

var passwordtem = window.prompt("Enter your password for TEM: ", “”);//sets the user’s password within TEM

alert(usernametem + “,” + passwordtem);

while (!sk.AreSigningKeysValid(usernametem, passwordtem)) {//as long as the signing keys are not valid

var msg = "Diagnostic Message: " + sk.DiagnosticMessage;//set up a diagnostic message to the user

if (msg != "Diagnostic Message: ") {//if the diagnostic message contains useful information

window.alert(msg);//send out the diagnostic message

}

usernametem = window.prompt("Enter your username for TEM: ", “”);//reprompt for a username

while (usernametem == “”) {//while the username is not entered

usernametem = window.prompt("Enter your username for TEM: ", “”);//reprompt for a username

}

passwordtem = window.prompt("Enter your password for TEM: ", “”);//reprompt for a password

sk.SetPrivateKeyPath(usernametem, “\\server\share\publisher.pvk”);

sk.SetPublisherCertPath(usernametem, “\\server\share\publisher.crt”);

sk.SetLicenseCertPath(usernametem, “\\server\share\license.crt”);

}

alert(“User: " + usernametem + " has successfully logged in”);//if the signing keys are correct send a success message

What happens on the computer I wrote the code on (using visual web developer if it matters) is I get to the alert at the bottom saying I was verified and everything was hunky-dory. However, when I go to another computer on the same network, and run the application, I get a diagnostic message saying that there was a "Database Error:

Microsoft

ODBC Driver Manager

Data source name not found and no default driver specified (IM002:0)"

I have made sure the odbc connection on the computer works through administrative tools -> data sources (ODBC) and that the driver is the same version on both machines (SQL Server Native Client 10.0). Can anyone help me out?

Thanks,

Ilithis

(imported comment written by Bhushan_Chirmade)

Are trying to run the application on 64-bit machine?

(imported comment written by SystemAdmin)

Thanks for replying bhushanchirmade,

Unfortunately it is a 32-bit machine I am using to run the application. With using a 32-bit machine I don’t have to worry about x64 ODBC connections since Windows separates them when using a 64-bit OS.

Good thought though!

Ilithis

(imported comment written by Bhushan_Chirmade)

I think you are missing following method:

sk.SetDefaultDSN(dsn)

The system where it is running might have default DSN already set that’s why you don’t need to set it. However when you move this code to different machine it does not have DSN set which might be causing this issue.

Please give a try.

  • Bhushan

(imported comment written by SystemAdmin)

Bhushanchirmade,

First off, I reread my previous post and I sounded kinda like a douche…sorry.

Second, you’re boss. I originally had used SetDSN in the original code, but I took it out because I didn’t seem to need it (doh). Threw that line of code back in there and it worked! =D Way to make my Monday awesome, I hope yours is equally as awesome!

Thanks,

Ilithis