zhlynn / zsign

Maybe it is the most quickly codesign alternative for iOS12+, cross-platform ( macOS, Linux , Windows ), more features.
BSD 3-Clause "New" or "Revised" License
1.28k stars 385 forks source link

Can't Load P12 or PrivateKey File! Please Input The Correct File And Password! #208

Closed Vortex853 closed 2 years ago

Vortex853 commented 2 years ago
ahmad@AHMADs-MacBook-Pro ~ % /Users/ahmad/Desktop/ZSIGN/Home_Top/ScriptNawaf.sh  
------------ Start sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G1/zeroESP-All_DMG_v33.ipa ------------
/Users/ahmad/Desktop/ZSIGN/Home_Top/ScriptNawaf.sh: line 19: /Users/ahmad/Desktop/ZSIGN/Home_Top/G1/zsign: No such file or directory
------------ Finish sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G1/zeroESP-All_DMG_v33.ipa ------------
ahmad@AHMADs-MacBook-Pro ~ % /Users/ahmad/Desktop/ZSIGN/Home_Top/ScriptNawaf.sh 
------------ Start sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G1/zeroESP-All_DMG_v33.ipa ------------
007EA81701000000:error:1700006B:CMS routines:cms_get_enveloped_type:content type not enveloped data:crypto/cms/cms_env.c:41:
007EA81701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: PEM
007EA81701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: type-specific
007EA81701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: PrivateKeyInfo
007EA81701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: DER
007EA81701000000:error:068000A8:asn1 encoding routines:asn1_check_tlen:wrong tag:crypto/asn1/tasn_dec.c:1188:
007EA81701000000:error:0688010A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:crypto/asn1/tasn_dec.c:752:
007EA81701000000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:crypto/asn1/tasn_dec.c:685:Field=pkey, Type=PKCS8_PRIV_KEY_INFO
007EA81701000000:error:068000A7:asn1 encoding routines:d2i_AutoPrivateKey_legacy:unsupported public key type:crypto/asn1/d2i_pr.c:195:
007EA81701000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:346:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
>>> Can't Load P12 or PrivateKey File! Please Input The Correct File And Password!
------------ Finish sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G1/zeroESP-All_DMG_v33.ipa ------------
------------ Start sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G2/zeroESP-All_DMG_v33.ipa ------------
00DEB71901000000:error:1700006B:CMS routines:cms_get_enveloped_type:content type not enveloped data:crypto/cms/cms_env.c:41:
00DEB71901000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: PEM
00DEB71901000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: type-specific
00DEB71901000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: PrivateKeyInfo
00DEB71901000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: DER
00DEB71901000000:error:068000A8:asn1 encoding routines:asn1_check_tlen:wrong tag:crypto/asn1/tasn_dec.c:1188:
00DEB71901000000:error:0688010A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:crypto/asn1/tasn_dec.c:752:
00DEB71901000000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:crypto/asn1/tasn_dec.c:685:Field=pkey, Type=PKCS8_PRIV_KEY_INFO
00DEB71901000000:error:068000A7:asn1 encoding routines:d2i_AutoPrivateKey_legacy:unsupported public key type:crypto/asn1/d2i_pr.c:195:
00DEB71901000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:346:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
>>> Can't Load P12 or PrivateKey File! Please Input The Correct File And Password!
------------ Finish sign /Users/ahmad/Desktop/ZSIGN/Home_Top/G2/zeroESP-All_DMG_v33.ipa ------------
ahmad@AHMADs-MacBook-Pro ~ % 

https://github.com/Nawaf-Mansour/Script_zsign

gyke69 commented 2 years ago

did you compile zsign, or you download compiled binary from somewhere else? it seem to me that you have installed the required dependencies for zsign.

install required dependencies for zsign. compile zsign edit script and add the password for you developer/enterprise certificate. put the certificate and mobile provision file according to the script path. sign your app/games. done

boxstore commented 2 years ago

compile with g++ .cpp common/.cpp -lcrypto -I/usr/local/Cellar/openssl@1.1/1.1.1l/include -L/usr/local/Cellar/openssl@1.1/1.1.1l/lib -O3 -o zsign

notice openssl path may be different

Vortex853 commented 2 years ago

did you compile zsign, or you download compiled binary from somewhere else? it seem to me that you have installed the required dependencies for zsign.

install required dependencies for zsign. compile zsign edit script and add the password for you developer/enterprise certificate. put the certificate and mobile provision file according to the script path. sign your app/games. done

i compiled zsign By g++ .cpp common/.cpp -lcrypto -I/usr/local/Cellar/openssl@3/3.0.0_1/include -L/usr/local/Cellar/openssl@3/3.0.0_1/lib -O3 -o zsign

liboshi commented 2 years ago

hit same issue with openssl@3

I tried following steps and then ipa can be resigned openssl pkcs12 -in ./certs.p12 -out test.pem -nodes ./zsign -f -k test.pem ...

FYI, my P12 file has no password.

liboshi commented 2 years ago

Update CMakeLists.txt, specify openssl version to 1.1 then use cmake to build. Issue will gone. image

h-o-sein commented 2 years ago

I also encountered this error after the update, if it worked with the same commands in the previous version! My p12 File Did not have a password!

Can't Load P12 or PrivateKey File! Please Input The Correct File And Password!

00EE290701000000:error:1700006B:CMS routines:cms_get_enveloped_type:content type not enveloped data:crypto/cms/cms_env.c:41:
00EE290701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: PEM
00EE290701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: type-specific
00EE290701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode.  Input type: DER, Input structure: PrivateKeyInfo
00EE290701000000:error:1E08010C:DECODER routines:OSSL_DECODER_from_bio:unsupported:crypto/encode_decode/decoder_lib.c:101:No supported data to decode. Input type: DER
00EE290701000000:error:068000A8:asn1 encoding routines:asn1_check_tlen:wrong tag:crypto/asn1/tasn_dec.c:1188:
00EE290701000000:error:0688010A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:crypto/asn1/tasn_dec.c:752:
00EE290701000000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:crypto/asn1/tasn_dec.c:685:Field=pkey, Type=PKCS8_PRIV_KEY_INFO
00EE290701000000:error:068000A7:asn1 encoding routines:d2i_AutoPrivateKey_legacy:unsupported public key type:crypto/asn1/d2i_pr.c:195:
00EE290701000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:346:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
AbdulrahmanAlenazi commented 2 years ago

Actually, the solution worked for me, as you mentioned. Thank you very much The problem is from openssl version 3 is causing the problem, the solution is to delete it and re-download it on OpenSSL version 1.1 And then edit a document /zsign/CMakeLists.txt , Update specify openssl version to 1.1 replace this line

        COMMAND brew --prefix OpenSSL
to
        COMMAND brew --prefix OpenSSL@1.1

Then enter this path and build by typing this command

cd /Users/admin/zsign/build 
cmake ..
make

Issue will gone.

abbbbbr commented 2 years ago

hk