• Home
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
  • CMS
    • Magento
    • Yahoo! Store

Code Signing Desktop App

Tuesday, 04 January 2022 14:22
Tim Ramsey
0 Comments
  1. Open a Powershell prompt.
  2. Create a new self-signed certificate for Code signing using “New-SelfSignedCertificate -DnsName “yourdomain.com” -Subject “CN=The Name of Your App” -Type CodeSigningCert -CertStoreLocation cert:\CurrentUser\My“. This will create a certificate in the Personal\Certificates folder of the Certificate Manager. You can view this by running “certmgr.msc” from a Run box.
  3. Export the certificate’s public key to an external file for import into the trusted publishers folder of Certificate Manager using “Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0] -FilePath “My Code Signing Cert.cer”. Note the “[0]” brackets after the Get-ChildItem call. This implies that the certificate that you want to export is the first child item found. If you have multiple code signing certificates in your Personal storage you may need to modify this parameter. You can always double-click on the CER file that is exported to see if you’ve gotten the correct certificate.
  4. Import the certificate file that you just exported to the trusted publishers storage using “Import-Certificate -FilePath ‘.\My Code Signing Cert.cer’ -Cert cert:\CurrentUser\Root“. This will trust the certificate on your development workstation.
  5. Finally, sign the executable file using “Set-AuthenticodeSignature .\MyApp.exe -Certificate (Get-ChildItem cert:\CurrentUser\My -CodeSigningCert)[0]”. The same caveat regarding the “[0}” array index applies here. This is the command that I could not locate. I kept using SignTool to sign the executable but it never worked. I’m not sure if it was the trusted publisher problem, or this step. This command specifies Authenticode so I think this may have had the most impact.

After that you should have the executable show up with a certificate when authenticating with Quickbooks.

https://help.developer.intuit.com/s/question/0D54R00007GdUpJ/how-to-use-signtool-to-certify-my-quickbooks-application

Note: I got most of the information that I used from this StackOverflow Q&A, particularly the answer from @chaami:

https://stackoverflow.com/questions/84847/how-do-i-create-a-self-signed-certificate-for-code-signing-on-windows

1
New-SelfSignedCertificate -DnsName "truelightdesigns.com" -Subject "CN=QuickBooks Importer" -Type CodeSigningCert -CertStoreLocation cert:\CurrentUser\My -NotAfter (Get-Date).AddMonths(600)
1
Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0] -FilePath "QuickBooks Importer.cer"

Github publickey denied

Thursday, 30 December 2021 21:04
Tim Ramsey
0 Comments

If you ever get a publickey denied error while trying to setup a github repo on a hosting account follow these steps.

  1. Create a new Public/Private SSH on server
  2. Copy public key and add a “deploy key” on github
  3. Add your privatekey to the git config
1
2
3
4
5
6
git -c core.sshCommand="ssh -i ~/.ssh/<your_key>" clone git@github.com:<user>/<repo>.git
 
git config core.sshCommand 'ssh -i ~/.ssh/<your_key>'
 
#test if key is working
ssh -T -ai ~/.ssh/g<your_key> git@github.com

Excel Compatible Partnumbers

Tuesday, 14 September 2021 15:51
Tim Ramsey
0 Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$compatible_partnums = [];
//param &$compatible_partnums
 
//Add the shared identifier and the unique identifier
if (array_key_exists('hardwarenum', $items)) {
    $compatible_partnums[$items['hardwarenum']][] = $items['partnum'];
}
 
$compats = array_map(function($k, $v) {
    return [$k, implode(', ', $v)];
}, array_keys($compatible_partnums), $compatible_partnums);
Excel::create($filename.
        '-hw',
        function($excel) use($newArray, $compats) {
            $excel - > sheet('Sheetname', function($sheet) use($newArray, $compats) {
                $sheet - > fromArray($compats);
            });
        }) - >
    export ('csv');

WHMCS Oauth userinfo.php not working

Wednesday, 21 July 2021 17:07
Tim Ramsey
0 Comments

I was trying to incorporate SSO in Freshdesk with WHMCS, but because WHMCS requires passing a query parameter = access_token instead of using the Authorization header, this is what you need to do to make it work.

1. Reveal Authorization Header in .htaccess

1
CGIPassAuth on

2. Use your own oauth-intermediary.php where you take the header and send the query parameter that WHMCS is expecting

1
2
3
4
5
6
7
8
9
10
11
<?php
//https://www.yousite.com/oauth/userinfo.php
//https://www.yousite.com/oauth-intermediary.php
header('Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.youtsite.com/oauth/userinfo.php?access_token=".str_replace("Bearer ","",getallheaders()["Authorization"]));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
echo $server_output;
curl_close ($ch);

3. User your new https://www.yousite.com/oauth-intermediary.php as the new userinfo.php URL when requested

Page 2 of 15

  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • 15
  • Next

Categories

  • CMS
    • Magento
    • Shopify
    • Yahoo! Store
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
    • SVN
  • VOIP

Recent Posts

  • How to write to Google Sheet with API in PHP
  • How to Migrate FreePBX server to a new server
  • Unifi Controller Java CPU 100%
  • Update Unifi Controller on Linux
  • Code Signing Desktop App