I am trying to write a simple console app in Visual Studio 2022 and then debug it. This would be so simple but the IT dept here have added a group policy that all applications must be digitally signed before they can be executed.
How can I sign the compiled executable file in order to run it in the VS debugger? I have a PFX certificate file but nothing I've tried seems to add a signature to the file properties in the exe file in the bin folder.
Thank you in advance.
I have tried:
Installing the certificate which was successful.
Generating a strong name snk file and ticking the option to sign the assembly which was successful.
Running the signtool in PS to apply the certificate which failed.
I would like to sign the executable as part of the build process in order to hit F5 and debug as normal.
I recently finished building a wallpaper app. The app works fine in debug build, but not in release. I have added anonymous authentication to the app and the following rules in cloud Firestore:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if
request.auth != null;
}
}
}
Moreover I have added the release sha1 and sha256 keys to firebase and updated the json file as well.
Nothing seems to fix this issue.
The app displays the images properly here when I run it from Android Studio:
App doesn't work when I export it to Play Store and download. The images simply wont show up:
when you upload an app in android studio the SHA1 key changes. There are two types of SHA1 keys one is used for debugging and other is used for Release. In your case when you use App in android studio it will not give you error as you have entered in firebase the SHA1 key for debugging.
for Android studio you need SHA1 key for Release for which you need to go to the play console and select your app. Then under setup go to app integrity here you will find SH1 key. Enter that key in your firebase authentication.
Always check your apk on emulator after the Signed built before uploading on PlayStore.
you can also find the SHA1 release key in android studio in Terminal.
you will need keytool command for that.
To execute Keytool command you need to go to the directory of Android Studio where Keytool.exe file is placed. for that you need to search Android studio directory. For me it was in "C:\Program Files\Android\Android Studio\jre\bin". So i entered in that directory using command
cd C:\Program Files\Android\Android Studio\jre\bin
then use keytool command
keytool -list -v -keystore "C:\Users\Yah\Google Drive\Android\booksapp\booksappkey.jks" -alias key0
This is the place where jks file is placed which was used for generation of signed apk
you will be asked for the password that you always used to generate signed apk
and the SHA1 key will be displayed which will be same as used in google play console.
I found a fix it wasn't related to the keys at all disabling progaurd fixed my issue app works fine now looks like I need to create rules to let the app load images not sure but this is what worked for me.
I am currently trying to sign VBA macros in Excel and Word and Powershell scripts via the cmd.
For this purpose I use the Microsoft signtool.exe as part of the Windows 10 SDK:
https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/
Signing Powershell scripts using the following command works fine:
signtool.exe sign /f "testca.pfx" /fd SHA256 /p "123456" "test.ps1"
For signing macros in Office documents, "Microsoft Office Subject Interface Packages for Digitally Signing VBA Projects" is also required:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=56617
I downloaded the .exe and executed it.
Registering the .dll files using: "regsvr32" also worked. The paths to the .dll files are visible in the registry.
Microsoft Visual C++ 2015-2019 Redistributable (x86) is also installed.
So theoretically I should be able to sign Excel macros now.
However, my server receives an error message with an error code, which I can't find anything about in Google.
Here is the complete output:
The following certificates were considered:
Issued to: TestCA
Issued by: TestCA
Expires: Wed Feb 03 08:53:09 2021
SHA1 hash: E19CE363C88CDBCE677FA170008D0AB0D98A02DC
After EKU filter, one certs were left. After expiry filter, 1 certs were left.
After Private Key filter, 1 certs were left. The following certificate was selected:
Issued to: TestCA
Issued by: TestCA
Expires: Wed Feb 03 08:53:09 2021
SHA1 hash: E19CE363C88CDBCE677FA170008D0AB0D98A02DC
The following additional certificates will be attached: Done Adding
Additional Store SignTool Error: An unexpected internal error has occurred.
Error information: "Error: SignerSign() failed. (-2147220492/0x800403f4)
I have now performed the installation as described above several times on different computers, all with admin rights and current updates:
Private win10 computer: .ps1 and .xlsm signing is possible
VM with win10 from work: .ps1 and .xlsm signing is possible
Private VM with win 7: only .ps1 signing works
Private VM with Win10: only .ps1 signing works
TerminalServer with Windows Server 2012: only .ps1 signing works
What you can probably say is that signtool.exe works as such, because I can sign PowerShell scripts on all machines.
But signing macros does not always work. Probably has something to do with the interface packages?
I hope somebody has had the same problem before and can help. Because I'm going crazy with this. Thanks a lot!
Well, it took me a long time, but I'm up and running now. If anybody else has the same problem:
The "Microsoft Office Subject Interface Packages for Digitally Signing VBA Projects" .zip contained a readme.txt saying "Microsoft Visual C++ Redistributal (x86)" must be installed. The link behind it downloaded the "Microsoft Visual C++ 2015-2019 Redistributal (x86)", which is the latest version.
I have now tested all available versions of the last years and the only working one is the 2010 version. I don't know why the readme.txt refers to a different version, but the bug and the "solution" are definitely reproducible.
Anyway, use Visual C++ 2010 and everything is fine!
When trying to test my app on my device iPhone, I get the following error, I think it's something about registering my device.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3):
Error MSB6006: "codesign" exited with code 1. (MSB6006)
(multifacturacion.iOS)
The strange thing is that this same device in another mac with xamarin if it works and with the same project.
If someone can help me with this, I have several days looking for a solution.
This went away for me after I cleaned the solution in Visual Studio.
(yes this is a complete answer, there are no citations, this is just what I did to fix it).
Open the info.plist and check "Automatic Provisioning".
Thing is, I am having this error regularily. I am working with a local developer certificate created on my Mac using a free Apple Id, but without a paid Apple Developer Membership. I am using a Windows based devloper workstation and program in Visual Studio 2019 with Xamarin.Forms 4.0. To get local deployment working again, I need to visit the general settings on my iPhone and remove my trusted account from the list of developer apps under device management which basically not only removes the account but also the app from the device.
Then I need to remove all occurances of the corresponding certificate on my Mac within the Keychain Utility and even the mobileprovision file on my harddrive located somewhere beneath my user directory.
Now I have to Start XCode on my Mac, open the project, I am working on and have it automatically "repair" the signing certificate which basically creates a new one and registers it in the Keychain. The moment I run the app from XCode, I need to always allow keychain access and on my iPhone I can see the account appear in the general settings again which I have to manually trust... again.
THEN I can open the corresponding project in my Visual Studio on my Windows Developer Workstation, rebuild and deploy the app and get no errors.
Without being able to say why, it could happen even the next time I try to build and deploy the app, that this error happens again... this is very (!) inconvenient and I didn't find any real solution for it yet...
remove your certificates from keychains and add again, close Info.plist open and fill de information on bundle singing option, that works for me, remember link your device with you provisioning.
The answer of Mephisztoe worked for me, except that I am working on Windows and you find the scheme-property in the project-settings and not in the plist-file.
Furthermore be sure that you installed fastlane (just open Extras > Options > Xamarin > Apple-Accounts and click on "install fastlane") and added your Apple-ID there.
I also deleted the certificate with the keychain-utility. That's why I had to reenter my password on the mac as I clicked on build on my windows machine.
With these steps done I can finally work again...
If the certificate of Apple developer is expired, you can get the error like "codesign", so you need to create a new certificate in Apple Developer site (https://developer.apple.com/account/), then download & install to your computer.
I have been struggling with the same issue for several days, the error came only when I tried to publish the app from my Windows VS 2019. It had no further details of why it was behaving like this.
What I changed was:
Created New Publishing Profile & Certificates
Instead of selecting Release in Configuration as suggested in this Microsoft article, I selected AppStore from the configuration.
Tried to recreate the archive and it was completed successfully.
Now when I tried to publish it, I encountered few error messages, I fixed them and submitted the app again. It worked fine.
For me, the issue was that there was a popup asking for a password on the network-attached Mac. I had to VNC into it and enter the password.
For some reason the first time I did this (and chose "always allow"), it failed again with this error, but the second time I ran it succeeded.
You'll want to make sure to have an app-specific password ready if you haven't already generated one. I have no idea why, but it prompts you for one in VS.
When you generate a APK in Android Studio you can secure the generation with a Master Password. Where in the filesystem is this password stored? I'm hoping I'm not committing this file in my project, i.e. and uploading it to Github:-)
The master password isn't actually stored, but it's used to encrypt the master password file, which lives in the security.xml file with your Android Studio preferences. That file contains encrypted versions of your keystore and key passwords if you check the "Remember Passwords" checkbox in the Generate Signed APK wizard; if you don't tell it to remember passwords, nothing is stored.
Where that file lives depends on your platform, but in general on Windows it will be in <User home>\.AndroidStudioPreview\config\security.xml, ~/Library/Preferences/AndroidStudioPreview/options/security.xml on MacOS, and ~/.AndroidStudioPreview/config/security.xml on Linux. See http://www.jetbrains.com/idea/webhelp/project-and-ide-settings.html for more information on where preferences are stored for IntelliJ; it's essentially the same for Android Studio.
You can find a little more information on the file in a SO question about trying to decrypt the file contents if the master password is known: Intellij IDEA - view saved password
For Android Studio version 1.0.2 on windows 7, the security.xml is located at
.AndroidStudio\config\options\security.xml
In my linux system this is where the security.xml file is located::
~/.AndroidStudio2.2/config/options/security.xml
Master passwords are encrypted (AES) and saved in security.xml file. It's location could change based on system and the version of android studio that you are using.
You can run the following command in command shell.
locate security.xml