Skip to content

Commit 223c2dd

Browse files
committed
Add test.
1 parent c54ed30 commit 223c2dd

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 = "AKISORANDOMAASORANDOM";
25+
private const string SigningTestSecretAccessKey = "q+jcrXGc+0zWN6uzclKVhvMmUsIfRPa4rlRandom";
26+
27+
/* The public coordinates of the ecc key derived from the above credentials pair */
28+
private const string SigningTestEccPubX = "15D242CEEBF8D8169FD6A8B5A746C41140414C3B07579038DA06AF89190FFFCB";
29+
private const string SigningTestEccPubY = "0515242CEDD82E94799482E4C0514B505AFCCF2C0C98D6A553BF539F424C5EC0";
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)