| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | |
|
| | 6 | | namespace Azure.Iot.Hub.Service.Authentication |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// The constants used for building the IoT hub service shared access signature token. |
| | 10 | | /// </summary> |
| | 11 | | internal static class SharedAccessSignatureConstants |
| | 12 | | { |
| | 13 | | // The following keys are used to parse the relevant fields from an IoT hub connection string. |
| | 14 | | internal const string HostNameIdentifier = "HostName"; |
| | 15 | | internal const string SharedAccessKeyIdentifier = "SharedAccessKey"; |
| | 16 | | internal const string SharedAccessPolicyIdentifier = "SharedAccessKeyName"; |
| | 17 | |
|
| | 18 | | // The following keys are used for constructing the shared access signature token. |
| | 19 | | // Example returned string: |
| | 20 | | // SharedAccessSignature sr=<Audience>&sig=<Signature>&se=<ExpiresOnValue>[&skn=<KeyName>] |
| | 21 | | internal const string SharedAccessSignatureIdentifier = "SharedAccessSignature"; |
| | 22 | | internal const string AudienceFieldName = "sr"; |
| | 23 | | internal const string SignatureFieldName = "sig"; |
| | 24 | | internal const string KeyNameFieldName = "skn"; |
| | 25 | | internal const string ExpiryFieldName = "se"; |
| | 26 | |
|
| | 27 | | // The Unix time representation of January 1, 1970 midnight UTC. |
| 2 | 28 | | internal static readonly DateTime s_epochTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); |
| | 29 | | } |
| | 30 | | } |