Module: Yast::CaManagementCrlInclude

Defined in:
../../src/include/ca-management/crl.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) createCRL(_CAname)

createCRL - creating new CRL

Parameters:

  • CA

    name

Returns:

  • `again



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File '../../src/include/ca-management/crl.rb', line 77

def createCRL(_CAname)
  ret = YaPI::CaManagement.ReadCRLDefaults(
    { "caName" => _CAname, "caPasswd" => getPassword(_CAname) }
  )
  Builtins.y2milestone(
    "ReadCRLDefaults(%1) return %2",
    { "caName" => _CAname },
    ret
  )

  # asking user
  UI.OpenDialog(
    Opt(:decorated),
    HBox(
      HSpacing(2),
      VBox(
        VSpacing(1),
        # popup window header
        Heading(_("Generate New CRL")),
        VSpacing(1),
        IntField(
          Id(:entry),
          _("&Valid to (days):"),
          1,
          10000,
          Builtins.tointeger(Ops.get_string(ret, "days", "30"))
        ),
        VSpacing(1),
        HBox(
          PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton),
          HStretch(),
          PushButton(Id(:cancel), Opt(:key_F9), Label.AbortButton)
        ), # push button label
        VSpacing(1)
      ),
      HSpacing(2)
    )
  )

  UI.SetFocus(Id(:entry))
  ui = nil
  begin
    ui = Convert.to_symbol(UI.UserInput)
    days = Convert.to_integer(UI.QueryWidget(Id(:entry), :Value))
    if ui == :ok
      # generating CRL
      ret2 = nil
      ret2 = YaPI::CaManagement.AddCRL(
        {
          "caName"   => _CAname,
          "caPasswd" => getPassword(CaMgm.currentCA),
          "days"     => Builtins.tostring(days)
        }
      )
      showErrorCaManagement if ret2 == nil || ret2 == false
    end
  end until Builtins.contains([:ok, :cancel], ui)
  UI.CloseDialog

  :again
end

- (Object) getCRLDescription(_CAname)

getDescription - CRL description

Parameters:

  • CA

    name

Returns:

  • a string with the CRL description



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File '../../src/include/ca-management/crl.rb', line 187

def getCRLDescription(_CAname)
  ret = Convert.to_map(
    YaPI::CaManagement.ReadCRL(
      {
        "caName"   => _CAname,
        "caPasswd" => getPassword(_CAname),
        "type"     => "parsed"
      }
    )
  )
  if ret == nil
    messageMap = YaPI.Error
    message = Ops.get_string(messageMap, "summary", "")
    description = Ops.get_string(messageMap, "description", "")
    if Ops.greater_than(Builtins.size(message), 0)
      retString = "\n"
      retString = Ops.add(Ops.add(retString, message), "\n")
      retString = Ops.add(retString, description)
      return retString
    end
  end
  Builtins.y2milestone("ReadCRL(%1): %2", _CAname, ret)

  text = _("<p><b>Certificate Revocation List (CRL):</b></p>")
  text = Ops.add(text, "<pre>")
  text = Ops.add(
    Ops.add(text, "\nVersion: "),
    Ops.get_string(ret, "VERSION", "")
  )
  text = Ops.add(
    Ops.add(text, "\nSignature Algorithmus: "),
    Ops.get_string(ret, "SIGNATURE_ALGORITHM", "")
  )
  text = Ops.add(
    Ops.add(text, "\nIssuer: "),
    Ops.get_string(ret, "ISSUER", "")
  )
  text = Ops.add(
    Ops.add(text, _("\n\nLast Update: ")),
    Ops.get_string(ret, "LASTUPDATE", "")
  )
  text = Ops.add(
    Ops.add(text, _("\nNext Update: ")),
    Ops.get_string(ret, "NEXTUPDATE", "")
  )
  counter = 0
  Builtins.foreach(Ops.get_list(ret, "REVOKED_PARSED", [])) do |element|
    text = Ops.add(text, _("\n\nRevoked Certificates: ")) if counter == 0
    counter = Ops.add(counter, 1)
    reason = Ops.get_string(element, "REASON", "")
    reason = Builtins.deletechars(reason, "\n")
    text = Ops.add(
      Ops.add(text, "\n     Serial Number: "),
      Ops.get_string(element, "SERIAL", "")
    )
    text = Ops.add(
      Ops.add(text, "\n            Date:   "),
      Ops.get_string(element, "DATE", "")
    )
    text = Ops.add(Ops.add(text, "\n            Reason: "), reason)
  end

  text
end

- (Yast::Term) getCRLTab

Dialog Tab - CRL -

Returns:

  • (Yast::Term)

    for the CRL of a selected CA



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File '../../src/include/ca-management/crl.rb', line 254

def getCRLTab
  contents = VBox(
    VSpacing(1),
    HBox(HSpacing(1), RichText(Id(:textinfo), ""), HSpacing(1)),
    HBox(
      HSpacing(1),
      PushButton(Id(:gererateCRL), _("&Generate CRL")),
      PushButton(Id(:view), _("&View")),
      PushButton(Id(:defaults), _("&Default")),
      HStretch(),
      # Fate (#2613)
      PushButton(Id(:exportDialog), _("Export")),
      #`MenuButton (_("Export"),
      #   [
      #    `item(`id(`exportFile), _("to &File") ),
      #    `item(`id(`exportLDAP), _("to &LDAP"))
      #    ]
      #   ),
      HSpacing(1)
    )
  )
  deep_copy(contents)
end

- (Object) handleCRLTab(event)

Handle events in a tab of a dialog



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File '../../src/include/ca-management/crl.rb', line 287

def handleCRLTab(event)
  event = deep_copy(event)
  ui = Ops.get(event, "ID")
  if ui == :gererateCRL
    createCRL(CaMgm.currentCA)
    ui = :again
  end
  showLongCRLDescription(CaMgm.currentCA) if ui == :view
  #	if (ui == `exportLDAP)
  #	{
  #	    exportToLDAP ("CRL", CaMgm::currentCA, "" ,"", "", "");
  #	}
  #	if (ui == `exportFile)
  #	{
  #	    exportCRLtoFile (CaMgm::currentCA);
  #	}
  exportCRL(CaMgm.currentCA) if ui == :exportDialog # (Fate #2613)
  editCRLDefaults(CaMgm.currentCA) if ui == :defaults
  Convert.to_symbol(ui)
end

- (Object) initCRLTab

Initialize the tab of the dialog



279
280
281
282
283
# File '../../src/include/ca-management/crl.rb', line 279

def initCRLTab
  UI.ChangeWidget(Id(:textinfo), :Value, getCRLDescription(CaMgm.currentCA))

  nil
end

- (Object) initialize_ca_management_crl(include_target)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File '../../src/include/ca-management/crl.rb', line 43

def initialize_ca_management_crl(include_target)
  Yast.import "UI"
  textdomain "ca-management"

  Yast.import "Label"
  Yast.import "CaMgm"
  Yast.import "YaPI::CaManagement"

  Yast.include include_target, "ca-management/crlDefault.rb"
  Yast.include include_target, "ca-management/crlExport.rb"

  # help text 1/4
  @CRLHelptext = _("<p>Here, see the most important values of the CRL.</p>")
  # help text 2/4
  @CRLHelptext = Ops.add(
    @CRLHelptext,
    _("<p>With <b>Generate CRL</b>, a new CRL will be generated.</p>")
  )
  # help text 3/4
  @CRLHelptext = Ops.add(
    @CRLHelptext,
    _("<p><b>View</b> shows a complete description.</p>")
  )
  # help text 4/4
  @CRLHelptext = Ops.add(
    @CRLHelptext,
    _("<p>You can <b>Export</b> the CRL to a file or LDAP Directory.</p>")
  )
end

- (Object) showLongCRLDescription(_CAname)

showLongCRLDescription - description of a CRL in textform

Parameters:

  • CA

    name



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File '../../src/include/ca-management/crl.rb', line 142

def showLongCRLDescription(_CAname)
  ret = Convert.to_string(
    YaPI::CaManagement.ReadCRL(
      {
        "caName"   => _CAname,
        "caPasswd" => getPassword(_CAname),
        "type"     => "plain"
      }
    )
  )

  Builtins.y2milestone("ReadCRL(%1): %3", _CAname, ret)
  ret = Ops.add(Ops.add("<pre>", ret), "</pre>")

  if ret == nil
    showErrorCaManagement
  else
    UI.OpenDialog(
      Opt(:decorated),
      HBox(
        VSpacing(16),
        VBox(
          HSpacing(100),
          # popup window header
          Heading(_("Description")),
          VSpacing(0.5),
          RichText(ret),
          VSpacing(1.5),
          # push button label
          PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton)
        )
      )
    )

    UI.SetFocus(Id(:ok))
    UI.UserInput
    UI.CloseDialog
  end

  nil
end