diff --git a/app/assets/javascripts/app/views/integration/smime_list.jst.eco b/app/assets/javascripts/app/views/integration/smime_list.jst.eco
index e716e1e88..a1e4f5473 100644
--- a/app/assets/javascripts/app/views/integration/smime_list.jst.eco
+++ b/app/assets/javascripts/app/views/integration/smime_list.jst.eco
@@ -25,9 +25,25 @@
<%- @datetime(cert.not_before_at) %>
| <%- @datetime(cert.not_after_at) %>
|
-
- <%- @Icon('trash') %>
-
+
+
+ <%- @Icon('overflow-button') %>
+
+
+
+ |
<% end %>
<% end %>
diff --git a/app/controllers/integration/smime_controller.rb b/app/controllers/integration/smime_controller.rb
index c95f27888..42005ddc9 100644
--- a/app/controllers/integration/smime_controller.rb
+++ b/app/controllers/integration/smime_controller.rb
@@ -3,6 +3,28 @@
class Integration::SMIMEController < ApplicationController
prepend_before_action { authentication_check && authorize! }
+ def certificate_download
+ cert = SMIMECertificate.find(params[:id])
+
+ send_data(
+ cert.raw,
+ filename: "#{cert.doc_hash}.crt",
+ type: 'text/plain',
+ disposition: 'attachment'
+ )
+ end
+
+ def private_key_download
+ cert = SMIMECertificate.find(params[:id])
+
+ send_data(
+ cert.private_key,
+ filename: "#{cert.doc_hash}.key",
+ type: 'text/plain',
+ disposition: 'attachment'
+ )
+ end
+
def certificate_list
render json: SMIMECertificate.all
end
diff --git a/config/routes/integration_smime.rb b/config/routes/integration_smime.rb
index 07b8a38f3..9cff6f855 100644
--- a/config/routes/integration_smime.rb
+++ b/config/routes/integration_smime.rb
@@ -1,10 +1,12 @@
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
- match api_path + '/integration/smime', to: 'integration/smime#search', via: :post
- match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_add', via: :post
- match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_delete', via: :delete
- match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_list', via: :get
- match api_path + '/integration/smime/private_key', to: 'integration/smime#private_key_add', via: :post
- match api_path + '/integration/smime/private_key', to: 'integration/smime#private_key_delete', via: :delete
+ match api_path + '/integration/smime', to: 'integration/smime#search', via: :post
+ match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_add', via: :post
+ match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_delete', via: :delete
+ match api_path + '/integration/smime/certificate', to: 'integration/smime#certificate_list', via: :get
+ match api_path + '/integration/smime/private_key', to: 'integration/smime#private_key_add', via: :post
+ match api_path + '/integration/smime/private_key', to: 'integration/smime#private_key_delete', via: :delete
+ match api_path + '/integration/smime/certificate_download/:id', to: 'integration/smime#certificate_download', via: :get
+ match api_path + '/integration/smime/private_key_download/:id', to: 'integration/smime#private_key_download', via: :get
end