@@ -2,7 +2,6 @@ package validation
22
33import (
44 "context"
5− "crypto"
65 "crypto/tls"
76 "fmt"
87 "io/ioutil"
@@ -30,8 +29,8 @@ func Validate(o *options.Options) error {
3029 msgs = append(msgs, validateRedisSessionStore(o)...)
3130 msgs = append(msgs, prefixValues("injectRequestHeaders: ", validateHeaders(o.InjectRequestHeaders)...)...)
3231 msgs = append(msgs, prefixValues("injectResponseHeaders: ", validateHeaders(o.InjectResponseHeaders)...)...)
33− msgs = parseSignatureKey(o, msgs)
3432 msgs = configureLogger(o.Logging, msgs)
33+ msgs = parseSignatureKey(o, msgs)
3534
3635 if o.SSLInsecureSkipVerify {
3736 // InsecureSkipVerify is a configurable option we allow
@@ -355,6 +354,8 @@ func parseSignatureKey(o *options.Options, msgs []string) []string {
355354 return msgs
356355 }
357356
357+ logger.Print("WARNING: `--signature-key` is deprecated. It will be removed in a future release")
358+
358359 components := strings.Split(o.SignatureKey, ":")
359360 if len(components) != 2 {
360361 return append(msgs, "invalid signature hash:key spec: "+
@@ -362,11 +363,9 @@ func parseSignatureKey(o *options.Options, msgs []string) []string {
362363 }
363364
364365 algorithm, secretKey := components[0], components[1]
365− var hash crypto.Hash
366− var err error
367− if hash, err = hmacauth.DigestNameToCryptoHash(algorithm); err != nil {
368− return append(msgs, "unsupported signature hash algorithm: "+
369− o.SignatureKey)
366+ hash, err := hmacauth.DigestNameToCryptoHash(algorithm)
367+ if err != nil {
368+ return append(msgs, "unsupported signature hash algorithm: "+o.SignatureKey)
370369 }
371370 o.SetSignatureData(&options.SignatureData{Hash: hash, Key: secretKey})
372371 return msgs