Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add API to generate public key from JWKs parameters [master] #22890

Merged
merged 8 commits into from
Apr 29, 2020

Conversation

ldclakmal
Copy link
Member

@ldclakmal ldclakmal commented Apr 24, 2020

Purpose

This PR introduces a new API buildRsaPublicKey to generate the public key from the JWKs parameters.

Example JWK:

{
  "keys": [
    {
      "kty": "RSA",
      "e": "AQAB",
      "use": "sig",
      "kid": "NTAxZmMxNDMyZDg3MTU1ZGM0MzEzODJhZWI4NDNlZDU1OGFkNjFiMQ",
      "alg": "RS256",
      "n": "luZFdW1ynitztkWLC6xKegbRWxky-5P0p4ShYEOkHs30QI2VCuR6Qo4Bz5rTgLBrky03W1GAVrZxuvKRGj9V9-PmjdGtau4CTXu9pLLcqnruaczoSdvBYA3lS9a7zgFU0-s6kMl2EhB-rk7gXluEep7lIOenzfl2f6IoTKa2fVgVd3YKiSGsyL4tztS70vmmX121qm0sTJdKWP4HxXyqK9neolXI9fYyHOYILVNZ69z_73OOVhkh_mvTmWZLM7GM6sApmyLX6OXUp8z0pkY-vT_9-zRxxQs7GurC4_C1nK3rI_0ySUgGEafO1atNjYmlFN-M3tZX6nEcA6g94IavyQ"
    }
  ]
}

How to use API:

string modulus = "luZFdW1ynitztkWLC6xKegbRWxky...";
string exponent = "AQAB";
crypto:PublicKey|crypto:Error publicKey = crypto:buildRsaPublicKey(modulus, exponent);

Fixes #22705

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@ldclakmal ldclakmal added this to the Ballerina 1.3.0 milestone Apr 24, 2020
@ldclakmal ldclakmal requested a review from praneesha April 29, 2020 05:08
Co-Authored-By: praneesha <praneesha@wso2.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Team/StandardLibs All Ballerina standard libraries Type/NewFeature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate public key from JWKs attributes
3 participants