How to sign a zip file on a machine where a certificate is installed of which I do not know the path? - sign

My employer has given me access to a VM where a certificate is installed. I tried sign installers (of the software I create) using the signtool and I succeeded. However, I also need to sign zip files. I have not succeeded so far. Here is the command-line statement:
signtool.exe sign /i "SOMEISSUERNAME" /fd SHA256 /a /v /t http://timestamp.digicert.com something.zip
This fails. Here is the error message:
SignTool Error: This file format cannot be signed because it is not
recognized.
I have searched online for solutions. The solutions I found online refer to the "the path to your certificate" (example). But I do not have that path. What I know is what is written in an email that I need to refer to the right issuername, which I did. It is working for installers but not for zip files.
Can I sign my zip file in such way as well? Or do I really need the path to my certificate?

The error message from signtool is telling you that the .zip format is not recognized.
Signtool is only able to sign PE (portable executable) filetypes and a few others, such as applications (.EXE, .cpl, .scr, .sys, etc), .DLL, .OCX, drivers, installers (.MSI, .APPX), .CAB, and .CAT files.
ZIP files with a .zip extension are not supported for signing.
One option is to convert the .zip to a self-extracting(SFX) .EXE archive or bundle the contents into an installer that can be signed.

A .zip file isn't an app, and it can't be signed, so it is unable to be signed by Signtool.

Zip does not have a signature standard. As #Superbob mentioned, you can create a self-extracting executable file for signing.
Or create your own program to sign and verify the signature and pack the zip file with your program. [1]
Another solution is to use a seperate Catalog file, and shipping the catalog file with your zip file. [2]

Related

To Determine if a .exe file is an setup file

I need to write a c/c++/kernel driver program where I can check if an .exe file is an Setup file where I can install new application in my computer (Like an .MSI file) or an normal application (For Example: If I Open an .exe file which is named as chorme.exe then it is an normal window application which only opens chrome browser , but if I Open an .exe file which is chromeinstaller.exe it is an installer which installs chrome browser in my computer).
Is there any way to determine if it's a setup file or just a application.
Microsoft itself tried to solve this with "Installer Detection" , and from their solution it becomes obvious that there is no hard solution. They look for:
Filename includes keywords like "install," "setup," "update," etc.
Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
Keywords in the side-by-side manifest embedded in the executable.
Keywords in specific StringTable entries linked in the executable.
Key attributes in the RC data linked in the executable.
Targeted sequences of bytes within the executable.
We can safely assume they're doing this because there is no ready-made solution.

What is the type and files in artifacts, aws buildspec yaml file

I am a noob. What is the 'artifacts' in the buildsepc yaml file?
I read on https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started-create-build-spec-console.html,
"Artifacts represents the set of build output artifacts that CodeBuild uploads to the output bucket. files represents the files to include in the build output."
Maybe, I am not understanding it correctly. Given the settings in the screenshot above, I expect two zipped files(template.yml and outputtemplate.yml) to be uploaded to the output bucket, say BUCKET=MYBUCKET.
But, when I check my S3 bucket after I build and deploy it, I have 2 files named like c7e84f72729709f7a0.
Also, just to understand what's going on, I tried removing the lines: 'type: zip' and '-template.yml', and built and deployed again. I expected only 1 file since I removed line 8 and 10. But, the result was still two files sitting in my bucket. What exactly are the artifacts? And What is the type?(this I can't even find any documentations). Why is the type in most cases, if not always, zip? when in fact the uploaded file is not actually not a zip file?
Thank you.
The file c7e84f72729709f7a0 is your zip file. It will contain both yml files. Just unpack it as any other zip file. May need to add extension .zip if required by your unpacking software.
I don't know where the type: zip comes from. The reference docs for the buldspec.yml do not document such a field.
And artifacts are outcomes files of your build. For example, when you are building a C++ project, it would be executable or library files resulting from compilation of your C++ source code.
The artifices are also carried over to a next stage of your CI/CD pipeline, such as integration testing or deployment with CodeDeploy.
Just to add to Marcin's answer, the type property of artifacts was deprecated in version 0.2 (the one that's being used here). You can see the changes across buildspec versions at the bottom of this page.

Cannot open include file: 'occi.h': No such file or directory

I am trying to compile an existing C++ project but get this error:
fatal error C1083: Cannot open include file: 'occi.h': No such file or directory
What I did is I went to this link:
http://www.oracle.com/technetwork/topics/winsoft-085727.html
and downloaded the first (basic) package.
Then unzipped the folder and modified PATH variable like this:
C:\Program Files\Atmel\sam-ba_2.12\drv\;C:\Program Files\Atmel\sam-ba_2.12;C:\Program Files\ATMEL Corporation\AT91-ISP v1.4\Library;C:\MSYS\1.0\bin;C:\MSYS\1.0\local\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin;D:\instantclient_12_1
last being path to oracle.
But I still get the error, can someone help?
PS I noticed in my project there are lines like:
#include "occi.h"
Maybe it is because of this?
The basic package isn't enough. Its description says "All files required to run OCI, OCCI, and JDBC-OCI application" (emphasis added); with just that you can run an OCI program, but you can't compile one. You need to download other instant client components. Specifically for the occi.h header you need the fifth file listed:
*Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client
If you download and unzip that in the same place you unzipped the basic package, your instant client directory will gain an sdk folder, which includes all the OCI header files.
You'll then need to compile with -I D:\instantclient_12_1\sdk\include so your compiler knows where to look for the occi.h and other header files. You may also need -L to tell it where to find the Oracle libraries; presumably you already have -lclntsh and/or -locci, which refer to libraries you should have already from the basic package.

Downloading directories WINDOWS

I have an application that transfers files via socket, desire that this also make transfers directories.
How can I download a full DIRECTORY via socket?
The program works like this, it asks the user to enter the remote directory where the file is to transfer Example: C:\users\server\file.dat
After it makes a validation to confirm the existence of the file,
and finally it transfers byte by byte.
The problem is that when the user type a directory validation fail, an example is if I type C:\users\SERVER\DIRECTORY
the program then returns an error FAILED IN READ BYTES
The solution would be to zip the directory, but the server only works with command line "shell", and Windows has nothing to zip by native command line.
Any suggestions?
You cannot read a directory like an ordinary file. You should search for all files yourself and send them one by one. This means you should also send paths to all files and reproduce their hierarchy yourself.

"Samples Environments for Microsoft Chart Controls" failing to compile

I wish to view the samples in the "Samples Environments for Microsoft Chart Controls" code available on the Microsoft website. However when I try to build the project in order to create an exe that I can open, I get the following error:
Cannot write to the output file "obj\Release\System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.VerticalTabPageButton.resources". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Am I missing something here? How am I supposed to navigate this set of samples?
Oh, and I manually edited the .sln file so it opens in VS2008. But I don't think that has anything to do with my problem.
I encountered the same problem when trying to unzip the "Samples Environments for Microsoft Chart Controls.zip" file.
I was attempting to unzip to my "Documents\Visual Studio 2010\Project" folder. Obviously this folder is quite far down a directory structure on the PC, so I received the same error.
So here's the solution: unzip the file to somewhere quite high up your PC's directory structure - for example, the root of your c drive, i.e. "c:\".
You'll then find you don't receive the "Path Too Long" error message.
Best wishes,
Mike.