Skip to content

Commit 14243ac

Browse files
committed
Add test.
1 parent c54ed30 commit 14243ac

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
using Amazon.Runtime.Internal.Auth;
17+
using Amazon.Util;
18+
using Xunit;
19+
20+
namespace UnitTests.NetStandard.Core
21+
{
22+
public class AWS4aSignerTests
23+
{
24+
private const string SigningTestAccessKeyId = "AKIDEXAMPLE";
25+
private const string SigningTestSecretAccessKey = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY";
26+
27+
/* The public coordinates of the ecc key derived from the above credentials pair */
28+
private const string SigningTestEccPubX = "b6618f6a65740a99e650b33b6b4b5bd0d43b176d721a3edfea7e7d2d56d936b1";
29+
private const string SigningTestEccPubY = "865ed22a7eadc9c5cb9d2cbaca1b3699139fedc5043dc6661864218330c8e518";
30+
31+
[Fact]
32+
public void DeriveSigningKey()
33+
{
34+
using var key = AWS4aSigner.ComputeSigningKey(SigningTestAccessKeyId, SigningTestSecretAccessKey);
35+
var parameters = key.ExportParameters(false);
36+
Assert.Equal(AWSSDKUtils.HexStringToBytes(SigningTestEccPubX), parameters.Q.X);
37+
Assert.Equal(AWSSDKUtils.HexStringToBytes(SigningTestEccPubY), parameters.Q.Y);
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)