.crt to .p12 file conversion gives "unable to load certificates" error - resttemplate

I have a name.crt file i convert it using the following command
openssl pkcs12 -export -in name.crt -inkey name.key -out name.p12 -name "name".
I get the following error
unable to load certificates
but the name.p12 file gets generated which I am not able to use as it shows EOF when using with rest template.
I tried the process by removing ^M from name.crt file which again shows
unable to load certificates

Related

Decrypting FileVault recovery key from fleetsmith

I'm trying to decrypt the dat file from fleetsmith. I have followed the steps (https://support.apple.com/pt-br/guide/fleetsmith/apd068558e73/web). Both files are inside the download folder, and the certificate is the right one.
but I'm getting this error:
openssl smime -decrypt -inform der \-in ~/Downloads/EncryptedFileVaultRecoveryKey_C02XH17HJG5H.dat \-inkey FleetsmithFileVaultKeyEncryptionPrivateKey_SOAH1FL8.pem \> FileVaultRecoveryKey.txt
Error opening signing key file FleetsmithFileVaultKeyEncryptionPrivateKey_SOAH1FL8.pem
4310681132:error:02FFF002:system library:func(4095):No such file or directory:/AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/libressl/libressl-2.8/crypto/bio/bss_file.c:255:fopen('FleetsmithFileVaultKeyEncryptionPrivateKey_SOAH1FL8.pem', 'r')
4310681132:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/libressl/libressl-2.8/crypto/bio/bss_file.c:257:
unable to load signing key file
```

Creating keystore for given RSA keys

I have private key and public key, both .pem files and I have to generate Java key Keystore for them.
I tried different openssl commands but I'm getting "unable to load certificates" error.
One such command I tried was:
openssl pkcs12 -export -in [path to certificate] -inkey [path to private key] -certfile [path to certificate ] -out testkeystore.p12
But I got:*unable to load certificates*
Please help to generate the keystore.

GNUPG Decryption command line

Am trying to decrypt an encrypted file, I have all the keys in place (secret and public), I don't know why its not generating output file. Following are the commands am running. I know there are several post already there but I cant refer them until and unless any error flashes on my command prompt.
gpg --list-secret-keys
Its listing secret keys
gpg --list-keys
Its listing all keys
gpg --import "c:\folder_location\name_PublicKey.gpg"
successfully imported keys
gpg --batch --yes --passphrase my_passphrase --local-user "mycomp name
" -o "c:\folder_location\filenameTEST.txt" -d
"c:\folder_location\ENCRYPTEDFILE.txt.gpg"
Am not able to decrypt file on command line, There is no error reported on command prompt. Command remains Active all the time, needed force close.
Anything am missing here to check? any suggestions?
There was no issue with my command, actual problem was CR and LF control characters (new line). When I removed those characters, decryption worked without any errors! GPG never detected these characters and statement got parsed without any error, and later command froze without any error/output.

Travis decrypting encrypted files with openssl fails

I have a project that requires some sensitive data. I have followed the steps specified at https://docs.travis-ci.com/user/encrypting-files/. However, some of the builds fail, and some others work just fine.
When a build succeeds I see this log:
Setting environment variables from repository settings
$ export encrypted_2c77c0ced414c_key=[secure]
$ export encrypted_2c77c0ced414c_iv=[secure]
$ export encrypted_c066d37aa1a1_key=[secure]
$ export encrypted_c066d37aa1a1_iv=[secure]
I don't see these environment variables when builds fail. I get this error instead:
The command "openssl aes-256-cbc -K $encrypted_2c77c0ced414c_key -iv $encrypted_c066d37aa1a1_key -in seeds.json.enc -out tests/data/seeds.json -d" failed and exited with 1 during .

How to decrypt smime.p7m file in DER format using OpenSSL in C code.

I am trying to decrypt emails using openssl.
I am getting smime.p7m file from the server. But it is in DER format.
I can decrypt this file using command prompt, with the command
openssl smime -decrypt -in openssl_working_smime.p7m -inform DER -inkey mycert.pem > dec_mail.eml
But now I want to do this using C code.
Right now I am trying to do using -
SMIME_read_PKCS7()
But this returns null with
SMIME_read_ASN1:no content type:asn_mime.c:451:
error
Any ideas how to do it?

Resources