How can I make signature by using aws-sdk-go?

Hello. I want to confirm terraform’s aws IAM login logic’s JWT Token.
So, with access_key and secret_key, I am making signature of that.

in aws-sdk-go, I could find GetSignature function, but I cannot convince what variables to use that.

func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error) {
	credValue, err := s.credentials.Get()
	if err != nil {
		return nil, err

	sigKey := deriveSigningKey(s.region, s.service, credValue.SecretAccessKey, date)

	keyPath := buildSigningScope(s.region, s.service, date)

	stringToSign := buildEventStreamStringToSign(headers, payload, s.prevSig, keyPath, date)

	signature := hmacSHA256(sigKey, []byte(stringToSign))
	s.prevSig = signature

	return signature, nil

this is the function located in aws/signer/v4/strea.go, How can I use it??

Thank you!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.