com.tmobile.oss.security.taap.jwe_4_5_2 1.0.0

Suggested Alternatives

com.tmobile.oss.security.taap.jwe

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
Install-Package com.tmobile.oss.security.taap.jwe_4_5_2 -Version 1.0.0
dotnet add package com.tmobile.oss.security.taap.jwe_4_5_2 --version 1.0.0
<PackageReference Include="com.tmobile.oss.security.taap.jwe_4_5_2" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add com.tmobile.oss.security.taap.jwe_4_5_2 --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: com.tmobile.oss.security.taap.jwe_4_5_2, 1.0.0"
#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.jwe_4_5_2 as a Cake Addin
#addin nuget:?package=com.tmobile.oss.security.taap.jwe_4_5_2&version=1.0.0

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

JSON Web Encryption (JWE) component o .NET 4.5.2 using RSA or EC keys.

Obtains public RSA and/or EC keys from a JWKS REST Service o Caches the public keys o Refreshes the public keys each hour.

Uses the public key to encrypt a PII string and creates a JWE encode string o For RSA key, uses RSA_OAEP_256 and A256GCM o For EC key, uses ECDH_ES_A256KW and A256GCM

Uses the private key to decrypt a JWE encode string o The public Key Id must be the same as the private Key Id.

C# ASP.NET MVC Sample Code:

appsettings.json

{ "EncryptionOptions": { "JwksUrl": "http://localhost:31102/api/jwks/v1/lab01/getjsonwebkeys", "CacheDurationSeconds": 3600 // 1 hour } }

Controller

public class HomeController : Controller
{
        private readonly Encryption encryption;

    public HomeController(Encryption encryption)
    {
        this.encryption = encryption;
    }

    [HttpGet]
    public IActionResult Index()
    {
        var encryptedJweViewModel = new EncryptedJweViewModel();
        encryptedJweViewModel.PhoneNumber = "(555) 555-5555";
        encryptedJweViewModel.ErrorMessage = " ";
        encryptedJweViewModel.EncryptedJwe = string.Empty;

        return View(encryptedJweViewModel);
    }

    [HttpPost]
    public async Task<IActionResult> Index(string submitButton, string encryptedJwe, EncryptedJweViewModel encryptedJweViewModel)
    {
        try
        {
            if (submitButton == "Encrypt")
            {
                encryptedJweViewModel.EncryptedJwe = await this.encryption.EncryptAsync(encryptedJweViewModel.PhoneNumber);
            }
            else if (submitButton == "Decrypt")
            {
                encryptedJweViewModel.DecryptedPhoneNumber = await this.encryption.DecryptAsync(encryptedJwe);
            }
        }
        catch(Exception ex)
        {
            encryptedJweViewModel.DecryptedPhoneNumber = string.Empty;
            encryptedJweViewModel.ErrorMessage = ex.Message;
            if (ex.InnerException != null)
            {
                encryptedJweViewModel.ErrorMessage += " " + ex.InnerException.Message;
            }
        }

        return View(encryptedJweViewModel);
    }

Model View

public class EncryptedJweViewModel   
{
   [DisplayName("Enter in a phone number:")]
   public string PhoneNumber { get; set; }
   
   [DisplayName("Encrypted JWE:")]
   public string EncryptedJwe { get; set; }

   [DisplayName("Decrypted JWE:")]
   public string DecryptedPhoneNumber { get; set; }

  [DisplayName("Error message:")]
   public string ErrorMessage { get; set; }    }

View

@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { id = "encryptionForm" }))
{
    <p>
        <label class="errorMessage">@Model.ErrorMessage</label>
    </p>
    <p>
        <label>Enter in a phone number:</label><br />
        @Html.TextBoxFor(m => m.PhoneNumber)<br />
        <input type="submit" name="submitButton" value="Encrypt">
    </p>
    <p>
        <label>Encrypted JWE:</label><br />
        <textarea name="encryptedJwe" form="encryptionForm">@Model.EncryptedJwe</textarea>
        <input type="submit" name="submitButton" value="Decrypt">
    </p>
    <p>
        <label>Decrypted phone number:</label><br />
        <input type="text" name="decryptedPhoneNumber" value="@Model.DecryptedPhoneNumber" />
    </p>
}

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

Initial release