aws-sdk-net: Intermitent Bad Request for StartWithSrpAuthAsync

While logging sometimes there is an error - “Invalid Input Given” due to Bad Request while using StartWithSrpAuthAsync. this is not happening every time and is an intermittent issue.

Expected Behavior

While creating a BigInteger it should check and make sure it is a valid number and should able to authenticate SRP auth request.

Current Behavior

Right now while generating BigInteger with random value here -

 internal static Tuple<BigInteger, BigInteger> CreateAaTuple()
        {
            BigInteger a, A;
            do
            {
                a = new BigInteger(16, new Random());
                A = g.ModPow(a, N);
            } while (A.Mod(N).Equals(BigInteger.Zero));

            return Tuple.Create<BigInteger, BigInteger>(A, a);
        }

sometimes its generating valid value which is not valid for AWS Cognito SRP auth. and should be identified early

Possible Solution

Steps to Reproduce (for bugs)

using this Auth-request I am able to reproduce the issue -

        InitiateAuthRequest initiateAuthRequest = new InitiateAuthRequest()
        {
            AuthFlow = AuthFlowType.USER_SRP_AUTH,
            ClientId = <AWS-CLIENT-ID>,
            AuthParameters = new Dictionary<string, string>(StringComparer.Ordinal)
            {
                { CognitoConstants.ChlgParamUsername, username },
                { CognitoConstants.ChlgParamSrpA, "b8feb74c204ff5" }
                //
            }
        };

        InitiateAuthResponse initiateResponse = await 
       provider.InitiateAuthAsync(initiateAuthRequest).ConfigureAwait(false);

Context

I am trying to authenticate the user using StartWithSrpAuthAsync it works fine 95 % but fails sometimes with Bad Request error and ended up showing Invalid Input Given error.

Your Environment

  • AWSSDK.Core version used: 3.3.18.2
  • Operating System and version: Win 10 64 bit
  • Visual Studio version: VS 2017

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

We are looking into it. Last correspondence with the service team indicate that it might be a client side issue after all. We are reviewing how SRP_A is generated.

I think that’s all we need for now. I’ll get in touch with the service team to chase down what’s going on here.