24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
+
+
+
+
+
+
+
+
+
+
|
\[privateKeyFile\] \[importFirst\]"
#
# NOTE: Indicate to the caller, if any, that we have failed.
#
exit 1
}
proc maybeForceHashAlgorithm { certificate keyPairType } {
#
# HACK: Some key pair types, e.g. DSA v1, require hard-coded
# hash algorithms, e.g. SHA1. Do that now, if needed.
#
if {$keyPairType eq "DSA"} then {
$certificate HashAlgorithm SHA1
}
}
proc isScriptFile { fileName } {
switch -exact -- [file extension $fileName] {
.tcl -
.tk -
.test -
.eagle {
|
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
-
+
+
-
+
+
|
set embedPrefix "# <<CERTIFICATE-1.0>>"
set embedSuffix "# <</CERTIFICATE-1.0>>"
#
# NOTE: Grab the public key we need to verify that our signing
# process worked correctly.
#
set publicKey [keypair open -alias -public $publicKeyFile]
set publicKey [keypair open \
-alias -public $publicKeyFile]
#
# NOTE: Grab the private key we need to actually create the
# detached certificate for the data file.
#
set privateKey [keypair open -alias -public -private $privateKeyFile]
set privateKey [keypair open \
-alias -public -private $privateKeyFile]
#
# NOTE: Has embedded certificate handling been requested?
# If so, make sure we can actually do it.
#
if {$embed && [isScriptFile $fileName]} then {
set shouldEmbed true
|
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
+
|
#
set certificateFile $fileName
#
# NOTE: Import the license certificate.
#
set certificate [certificate import $fileName]
maybeForceHashAlgorithm $certificate [$privateKey KeyPairType]
#
# HOOK: Post-certificate object creation (import).
#
catch {certificate_hook phase1}
#
|
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
|
+
+
|
#
if {$importFirst} then {
set certificate [certificate import -alias $certificateFile]
} else {
set certificate [object create -alias \
Licensing.Components.Public.Certificate]
}
maybeForceHashAlgorithm $certificate [$privateKey KeyPairType]
#
# HOOK: Post-certificate object creation (create).
#
catch {certificate_hook phase1}
#
|