cert/lib/cert/runner.rb in fastlane-2.26.1 vs cert/lib/cert/runner.rb in fastlane-2.27.0.beta.20170407010056
- old
+ new
@@ -107,11 +107,11 @@
return path
else
UI.error "Certificate #{certificate.id} (#{certificate.name}) can't be found on your local computer"
end
- File.delete(path) # as apparently this certificate is pretty useless without a private key
+ File.delete(path) # as apparantly this certificate is pretty useless without a private key
end
UI.important "Couldn't find an existing certificate... creating a new one"
return nil
end
@@ -158,13 +158,20 @@
# Store all that onto the filesystem
request_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.certSigningRequest"))
File.write(request_path, csr.to_pem)
- private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12"))
+ private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.pkey"))
File.write(private_key_path, pkey)
cert_path = store_certificate(certificate)
+
+ if Cert.config[:generate_p12]
+ p12_cert_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12"))
+ p12 = OpenSSL::PKCS12.create(Cert.config[:p12_password], type_name, pkey, certificate.download)
+ File.write(p12_cert_path, p12.to_der)
+ UI.success "p12 certificate: #{p12_cert_path}"
+ end
# Import all the things into the Keychain
keychain = File.expand_path(Cert.config[:keychain_path])
password = Cert.config[:keychain_password]
FastlaneCore::KeychainImporter.import_file(private_key_path, keychain, keychain_password: password)