349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
}
"session" {
lassign $args session_id ticket lifetime
log 0 "TLS/$chan: session: lifetime $lifetime"
}
"verify" {
return [tls::validate_command $option $chan {*}$args]
}
default {
return -code error "bad option \"$option\":\
must be one of error, info, message, or session"
}
}
}
#
# Sample callback when return value is needed
#
proc tls::validate_command {option chan args} {
variable debug
switch -- $option {
"alpn" {
lassign $args protocol match
|
>
|
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
}
"session" {
lassign $args session_id ticket lifetime
log 0 "TLS/$chan: session: lifetime $lifetime"
}
"verify" {
# Backwards compatible for v1.7
return [tls::validate_command $option $chan {*}$args]
}
default {
return -code error "bad option \"$option\":\
must be one of error, info, message, or session"
}
}
}
#
# Sample callback when return value is needed. New for TLS 1.8+.
#
proc tls::validate_command {option chan args} {
variable debug
switch -- $option {
"alpn" {
lassign $args protocol match
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
}
if {$cb(handshake) == "done"} {
return 1
}
}
}
proc tls::password {{option password} {rwflag 0} {size 0}} {
log 0 "TLS/Password: did you forget to set your passwd!"
# Return the worlds best kept secret password.
return "secret"
}
proc tls::log {level msg} {
|
>
>
>
|
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
}
if {$cb(handshake) == "done"} {
return 1
}
}
}
#
# Sample callback to get password when needed. Args are new for TLS 1.8+.
#
proc tls::password {{option password} {rwflag 0} {size 0}} {
log 0 "TLS/Password: did you forget to set your passwd!"
# Return the worlds best kept secret password.
return "secret"
}
proc tls::log {level msg} {
|