aps_developer_imentity.cer إلى P12 دون الحاجة إلى تصدير من سلسلة المفاتيح؟

StackOverflow https://stackoverflow.com/questions/1453286

سؤال

انا املك إلقاء الحمل من "Aps_developer_imentity.cer" تصديرها من بوابة مطور iPhone. تم إنشاء جميعها باستخدام نفس طلب توقيع الشهادة (وهكذا) نفس المفتاح الخاص. إذا قمت بالتصدير فقط المفتاح الخاص من سلسلة مفتاح Apple، فمن الممكن إذن أن تأخذ المفتاح الخاص و APS_DEVEVEVEVEVEVEVEVEVEVEVEST_IDENDIATION.cer "واستخدام OpenSSL لإنشاء شهادة دمج P12 / PKCS # 12 التي يمكنني استخدامها في خادم (Windows) وبعد

فقط أن تكون واضحا، وأنا أعرف كيفية الحصول على P12 مدمجة من السلسلة الرئيسية عن طريق تصدير كل من المفتاح والخطوة الخاصة معا، لكنني أريد إزالة جميع النقر فوق الفأرة الإضافي والكتابة إذا استطعت.

هل كانت مفيدة؟

المحلول

تمكنت من العمل هذا، إنها تحتاج فقط إلى التغليف في برنامج نصي شل، ومن الجيد الذهاب. أفترض أنك قمت بتنزيله وإعادة تسميته شهادة "Apple_developer_imentity.cer"، وهنا أستخدم "Test.cer"، وأنك قمت أيضا بتصدير مفتاح المطور الخاص بك من المفاتيح الخاصة بك، في المثال أدناه المسمى "private_dev_key.p12".

#convert *.cer (der format) to pem
openssl x509 -in test.cer -inform DER -out test.pem -outform PEM

#convert p12 private key to pem (requires the input of a minimum 4 char password)
openssl pkcs12 -nocerts -out private_dev_key.pem -in private_dev_key.p12

# if you want remove password from the private key
openssl rsa -out private_key_noenc.pem -in private_key.pem

#take the certificate and the key (with or without password) and create a PKCS#12 format file
openssl pkcs12 -export -in test.pem -inkey private_key_noenc.pem -certfile _CertificateSigningRequest.certSigningRequest  -name "test" -out test.p12

ملاحظة: إذا كنت تعتقد أن هذا ينحدر كل شيء لفترة طويلة لتحقيق ما يمكن القيام به مع عدد قليل من نقرات الماوس وكتابة اسم الملف، ثم ضع في اعتبارك الحال في حالة وجود 20 تطبيقا ترغب في تمكين الإشعارات. يحتوي كل تطبيق على شهادة تطوير وإنتاجية، تنتهي صلاحيتها في 4 و 12 شهرا على التوالي. هذا هو مملة للغاية والخطأ وظيفة عرضة ...

نصائح أخرى

عمل رائع هنا. شكرا للمساعدة الحقيقية الرجال. لقد انخفضت في البرنامج النصي SHELL أدناه قد يساعد الآخرين. لدي العديد من المفاتيح للتعامل مع وسين نصي مطلوب أيضا. سيتم إخراج هذا البرنامج النصي أسماء ثابتة لملفات الإخراج (على الرغم من أنه سيكون من السهل التغيير).

آمل أن يساعد شخص آخر.

مثال على استخدام (على افتراض اسم البرنامج النصي):

$ . thisScript request_file.cer priv_key.p12 aps_dev.cer

النص:

if [ $# -ne 3 ]
then
echo "Error in $0 - Invalid Argument Count"
echo "Syntax: $0 request_cer_file p12_file app_cer_file output_filename"
echo "  - request_cer_file      is the request file you sent to apple"
echo "  - p12_file          is found in your keychain (it's the private key)"
echo "  - app_cer_file          is found on App ID screen from Apple"
else

reqFile=$1
p12File=$2
cerFile=$3

certPEM='apn_cert.pem'
pKeyPEM='apn_pkey.pem'
pKeyNoEncPEM='apn_pkey_noenc.pem'
p12FileOut='apn_cert_key.p12'

# remove old
rm $certPEM
rm $pKeyPEM
rm $pKeyNoEncPEM
rm $p12FileOut

#convert *.cer (der format) to pem
openssl x509 -in $cerFile -inform DER -out $certPEM -outform PEM

#convert p12 private key to pem (requires the input of a minimum 4 char password)
openssl pkcs12 -nocerts -out $pKeyPEM -in $p12File

# if you want remove password from the private key
openssl rsa -out $pKeyNoEncPEM -in $pKeyPEM

#take the certificate and the key (with or without password) and create a PKCS#12 format file
openssl pkcs12 -export -in $certPEM -inkey $pKeyNoEncPEM -certfile $reqFile  -name "apn_identity" -out $p12FileOut

#
#   
#   If all things worked then the following should work as a test
#   openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apn_cert.pem -key apn_pkey_noenc.pem 
#
#
echo "Looks like everything was successful"
echo "Test command:"
echo "openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apn_cert.pem -key apn_pkey_noenc.pem"
echo
fi

يمكنك جعل شهادة P12 / PKCS # 12 مباشرة في سلسلة المفاتيح. لا حاجة لتنفيذ أي أمر.

1. انقر فوق النقر فوق ملف تعريف المطور / الإنتاج الذي تم تنزيله من موقع Apple Dev. (سوف تتم إضافته في سلسلة المفاتيح)

2. أنا أفترض أن لديك ملف .p12 الذي حصلت عليه من تصدير مفتاح خاص

3.Go إلى علامة التبويب شهادات بلدي تحت سلسلة المفاتيح.

ما عليك سوى النقر على شهادة DEV / PROD الخاصة بك ل APN.IT يجب أن تظهر مفتاح خاص مرتبط به

4.Right انقر وتصدير شهادة في تنسيق .p12

هذا هو ملف .p12 النهائي!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top