question

newuser-7cc9c182-a356-4086-8915-d41d33951d6e avatar image
newuser-7cc9c182-a356-4086-8915-d41d33951d6e asked ·

Advanced Security Model response:{The provided 'encryptedPayload' could not be decrypted}

when I send request to 'https://api.amazonpinata.com/v1/players/register',get the errror:

{"error":{"code":100,"message":"The provided 'encryptedPayload' could not be decrypted. Ensure the payload is encrypted with the Game Public Key provided upon registration.","request_id":"93e2ba9b-0e46-11e9-b836-b5adbd9fa2d1"}}

I use the sample code that supported from GameOn To create the Client public/private key.

And encrypt the ClientPublicKey with GamePublicKey ,But the response code= 400,and the error.

the encrypt code:

public static string Encrypt(string publicKey, string payload)
        {
            var key = (RsaKeyParameters)PublicKeyFactory.CreateKey(Convert.FromBase64String(publicKey));
            var param = DotNetUtilities.ToRSAParameters(key);

            using (var csp = new RSACryptoServiceProvider())
            {
                csp.ImportParameters(param);

                var encrypted = csp.Encrypt(Encoding.UTF8.GetBytes(payload), false);

                return Convert.ToBase64String(encrypted);
            }
        }


requestgameon
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Levon@Amazon avatar image
Levon@Amazon answered ·

Hi there,

Based on the provided request_id, this issue appears to be a duplicate of your earlier Contact Us message.

The sample code cited here is only for games that were registered before Aug 15, 2018 and has been deprecated.

The game corresponding to the provided request_id uses an updated advanced security authentication. For games registered after Aug 14, 2018, please refer to the new Cryptography code samples V2 found on the code samples page: https://developer.amazon.com/docs/gameon/download-samples.html#downloads

For new games that you register after Aug 14, 2018, the GameOn advanced security authentication requires you to generate longer keys (2048 bits) for your players and use OAEP (a padding mechanism) while encrypting and decrypting.
1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thanks for reply .It worked.

this issue is from the documents of chinese and english is different. I send some message to you. check it. thanks again.

1 Like 1 ·