TwoStepSignStep1Dialog3.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. ///////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) 2018 Intel Corporation. //
  3. // //
  4. // All rights reserved. This program and the accompanying materials //
  5. // are made available under the terms of the Eclipse Public License v1.0 //
  6. // which accompanies this distribution, and is available at //
  7. // http://www.eclipse.org/legal/epl-v10.html //
  8. // //
  9. // Contributors: //
  10. // Intel Corporation - initial implementation and documentation //
  11. ///////////////////////////////////////////////////////////////////////////
  12. package com.intel.sgx.dialogs;
  13. import org.eclipse.swt.SWT;
  14. import org.eclipse.swt.layout.GridData;
  15. import org.eclipse.swt.layout.GridLayout;
  16. import org.eclipse.swt.widgets.Composite;
  17. import org.eclipse.swt.widgets.Control;
  18. import org.eclipse.swt.widgets.Group;
  19. import org.eclipse.swt.widgets.Label;
  20. import org.eclipse.swt.widgets.Shell;
  21. import com.intel.sgx.handlers.TwoStepSignHandlerBase;
  22. public class TwoStepSignStep1Dialog3 extends TwoStepSignDialogBase {
  23. final private TwoStepSignHandlerBase handler;
  24. public TwoStepSignStep1Dialog3(Shell parentShell, TwoStepSignHandlerBase handler) {
  25. super(parentShell);
  26. this.handler = handler;
  27. }
  28. protected Control createDialogArea(Composite parent) {
  29. Composite composite = (Composite) super.createDialogArea(parent);
  30. final GridLayout gridLayout = new GridLayout(1, false);
  31. composite.setLayout(gridLayout);
  32. addInfoGroup(composite);
  33. externalSignPublicKeyFileField = addGroup(composite, "Public Key:",
  34. "Select the Public Key file obtained from signing facility",
  35. "Public Key:", "Select", publicKeyLocationSelectionListener);
  36. externalSignedHashFileField = addGroup(composite, "Signature:",
  37. "Select the Signature file obtained from signing facility.",
  38. "Signature:",
  39. "Select", externalSignedHashFileSelectionListener);
  40. outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:",
  41. "Select where to save the output Signed Enclave.",
  42. "Signed Enclave:",
  43. "Select", outputSignedEnclaveListener);
  44. return composite;
  45. }
  46. protected void addInfoGroup(Composite composite) {
  47. final Group container = new Group(composite, SWT.None);
  48. container.setLayout(new GridLayout(3,false));
  49. GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
  50. innergrid1.horizontalSpan = 3;
  51. container.setLayoutData(innergrid1);
  52. container.setText("Hash and Enclave:");
  53. addInfoKeyValue(container, "Enclave File:", handler.enclaveFile);
  54. addInfoKeyValue(container, "Config File:", handler.configFile);
  55. addInfoKeyValue(container, "Hash File:", handler.hashFile);
  56. }
  57. private void addInfoKeyValue(final Group container, String key,
  58. String value) {
  59. final Label messageLabel2 = new Label(container, SWT.NONE);
  60. messageLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
  61. messageLabel2.setText(key);
  62. final Label messageLabel3 = new Label(container, SWT.NONE);
  63. messageLabel3.setText(value);
  64. messageLabel3.setLayoutData(new GridData(GridData.BEGINNING));
  65. }
  66. @Override
  67. protected void okPressed() {
  68. handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText();
  69. handler.externallySignedHashFile = externalSignedHashFileField.getText();
  70. handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText();
  71. super.okPressed();
  72. }
  73. @Override
  74. protected void configureShell(Shell newShell) {
  75. super.configureShell(newShell);
  76. newShell.setText("Two Step Enclave Sign - Generate Signed Enclave");
  77. }
  78. }