signature_does_not_match_wrapper.go 1018 B

123456789101112131415161718192021222324252627282930
  1. package errors
  2. import "strings"
  3. const SignatureDostNotMatchErrorCode = "SignatureDoesNotMatch"
  4. const MessagePrefix = "Specified signature is not matched with our calculation. server string to sign is:"
  5. type SignatureDostNotMatchWrapper struct {
  6. }
  7. func (*SignatureDostNotMatchWrapper) tryWrap(error *ServerError, wrapInfo map[string]string) (ok bool) {
  8. clientStringToSign := wrapInfo["StringToSign"]
  9. if error.errorCode == SignatureDostNotMatchErrorCode && clientStringToSign != "" {
  10. message := error.message
  11. if strings.HasPrefix(message, MessagePrefix) {
  12. serverStringToSign := message[len(MessagePrefix):]
  13. if clientStringToSign == serverStringToSign {
  14. // user secret is error
  15. error.recommend = "Please check you AccessKeySecret"
  16. } else {
  17. error.recommend = "This may be a bug with the SDK and we hope you can submit this question in the " +
  18. "github issue(https://github.com/aliyun/alibaba-cloud-sdk-go/issues), thanks very much"
  19. }
  20. }
  21. ok = true
  22. return
  23. }
  24. ok = false
  25. return
  26. }