com.tmobile.oss.security.taap.poptoken.builder 1.0.4

This component will create a Proof Of Possession (PoP) Token .NET Standard 2.1

Install-Package com.tmobile.oss.security.taap.poptoken.builder -Version 1.0.4
dotnet add package com.tmobile.oss.security.taap.poptoken.builder --version 1.0.4
<PackageReference Include="com.tmobile.oss.security.taap.poptoken.builder" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add com.tmobile.oss.security.taap.poptoken.builder --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: com.tmobile.oss.security.taap.poptoken.builder, 1.0.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install com.tmobile.oss.security.taap.poptoken.builder as a Cake Addin
#addin nuget:?package=com.tmobile.oss.security.taap.poptoken.builder&version=1.0.4

// Install com.tmobile.oss.security.taap.poptoken.builder as a Cake Tool
#tool nuget:?package=com.tmobile.oss.security.taap.poptoken.builder&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Proof Of Possession (PoP) Token Builder using .NET Standard 2.1

Implementation Details
The T-Mobile Proof Of Possession (PoP) Token Builder component creates JWS tokens using the following logic:
• Sets up the edts (external data to sign) and ehts (external headers to sign) claims in PoP token using the specified ehts key-value map.
• The library uses SHA256 algorithm for calculating the edts
• And then the final edts value is encoded using Base64 URL encoding.
• Signs the PoP token using the specified RSA private key.
• Creates the PoP token with 2 minutes of validity period.
• Current PoP token builder libraries support RSA PKCS8 format key for signing and validating the PoP tokens.

Determining the ehts Key Name
• For HTTP request URI, "uri" should be used as ehts key name, PopEhtsKeyEnum.Uri.GetDescription().
• For "uri" ehts value, the URI and query string of the request URL should be put in the ehts key-value map. Example:
• If the URL is https://api.t-mobile.com/commerce/v1/orders?account-number=0000000000 then only /commerce/v1/orders?account-number=0000000000 should be used as ehts value.
• The query parameter values part of "uri" ehts value should not be in URL encoded format.
• For HTTP method, "http-method" should be used as ehts key name, PopEhtsKeyEnum.HttpMethod.GetDescription().
• For HTTP request headers, the header name should be used as ehts key name.
• For HTTP request body, "body" should be used as ehts key name, PopEhtsKeyEnum.Body.GetDescription().
• For code sample, see test “PopTokenBuilder_Build_ValidPopToken_Success_Test”

Supported Key Format
The PoP token builder library currently supports PKCS8 key format.

Using Non Encrypted Keys:
Below commands shows how to create private and public keys in PKCS8 format:

# Create a 2048 bit Private RSA key in PKCS1 format
openssl genrsa -out private-key-pkcs1.pem 2048

# Convert the Private RSA key to PKCS8 format. 
openssl pkcs8 -topk8 -inform PEM -in private-key-pkcs1.pem -outform PEM -nocrypt -out private-key-pkcs8.pem

# Create a Public RSA key in PKCS8 format
openssl rsa -in private-key-pkcs8.pem -outform PEM -pubout -out public-key.pem

**C# Code Example **
https://github.com/cprothm1/tmobile-api-security-lib/blob/master/poptoken-lib/poptoken-builder/cs-lib-tmobile-oss-poptoken-builder/poptoken.builder.test/PopTokenBuilder.UnitTest.cs

Proof Of Possession (PoP) Token Builder using .NET Standard 2.1

Implementation Details
The T-Mobile Proof Of Possession (PoP) Token Builder component creates JWS tokens using the following logic:
• Sets up the edts (external data to sign) and ehts (external headers to sign) claims in PoP token using the specified ehts key-value map.
• The library uses SHA256 algorithm for calculating the edts
• And then the final edts value is encoded using Base64 URL encoding.
• Signs the PoP token using the specified RSA private key.
• Creates the PoP token with 2 minutes of validity period.
• Current PoP token builder libraries support RSA PKCS8 format key for signing and validating the PoP tokens.

Determining the ehts Key Name
• For HTTP request URI, "uri" should be used as ehts key name, PopEhtsKeyEnum.Uri.GetDescription().
• For "uri" ehts value, the URI and query string of the request URL should be put in the ehts key-value map. Example:
• If the URL is https://api.t-mobile.com/commerce/v1/orders?account-number=0000000000 then only /commerce/v1/orders?account-number=0000000000 should be used as ehts value.
• The query parameter values part of "uri" ehts value should not be in URL encoded format.
• For HTTP method, "http-method" should be used as ehts key name, PopEhtsKeyEnum.HttpMethod.GetDescription().
• For HTTP request headers, the header name should be used as ehts key name.
• For HTTP request body, "body" should be used as ehts key name, PopEhtsKeyEnum.Body.GetDescription().
• For code sample, see test “PopTokenBuilder_Build_ValidPopToken_Success_Test”

Supported Key Format
The PoP token builder library currently supports PKCS8 key format.

Using Non Encrypted Keys:
Below commands shows how to create private and public keys in PKCS8 format:

# Create a 2048 bit Private RSA key in PKCS1 format
openssl genrsa -out private-key-pkcs1.pem 2048

# Convert the Private RSA key to PKCS8 format. 
openssl pkcs8 -topk8 -inform PEM -in private-key-pkcs1.pem -outform PEM -nocrypt -out private-key-pkcs8.pem

# Create a Public RSA key in PKCS8 format
openssl rsa -in private-key-pkcs8.pem -outform PEM -pubout -out public-key.pem

**C# Code Example **
https://github.com/cprothm1/tmobile-api-security-lib/blob/master/poptoken-lib/poptoken-builder/cs-lib-tmobile-oss-poptoken-builder/poptoken.builder.test/PopTokenBuilder.UnitTest.cs

Release Notes

Updated component to use .NET Standzard 2.1.
Updated Microsoft.IdentityModel.JasonWebTokens component to 6.9.0.
Updated Builder to accept PEM or XML Key format.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.4 53 3/16/2021
1.0.3 329 12/10/2020
1.0.1 185 4/23/2020