com.nimbusds.jose
Class RSAKey

java.lang.Object
  extended by com.nimbusds.jose.JWK
      extended by com.nimbusds.jose.RSAKey
All Implemented Interfaces:
net.minidev.json.JSONAware

@Immutable
public final class RSAKey
extends JWK

Public RSA JSON Web Key (JWK). This class is immutable.

Example JSON:

 { 
   "kty" : "RSA",
   "n"   : "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx
            4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMs
            tn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2
            QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbI
            SD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqb
            w0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
   "e"   : "AQAB",
   "alg" : "RS256"
   "kid" : "2011-04-29"}
 }
 

See http://en.wikipedia.org/wiki/RSA_%28algorithm%29

Version:
$version$ (2013-01-08)
Author:
Vladimir Dzhuvinov

Constructor Summary
RSAKey(Base64URL n, Base64URL e, Use use, Algorithm alg, String kid)
          Creates a new public RSA JSON Web Key (JWK) with the specified parameters.
 
Method Summary
 Base64URL getExponent()
          Returns the exponent value for this RSA public key.
 Base64URL getModulus()
          Returns the modulus value for this RSA public key.
static RSAKey parse(net.minidev.json.JSONObject jsonObject)
          Parses a public RSA JWK from the specified JSON object representation.
 net.minidev.json.JSONObject toJSONObject()
          Returns a JSON object representation of this JWK.
 
Methods inherited from class com.nimbusds.jose.JWK
getAlgorithm, getKeyID, getKeyType, getKeyUse, parse, parseAlgorithm, parseKeyID, parseKeyUse, toJSONString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSAKey

public RSAKey(Base64URL n,
              Base64URL e,
              Use use,
              Algorithm alg,
              String kid)
Creates a new public RSA JSON Web Key (JWK) with the specified parameters.

Parameters:
n - The the modulus value for the RSA public key. It is represented as the Base64URL encoding of value's big endian representation. Must not be null.
e - The exponent value for the RSA public key. It is represented as the Base64URL encoding of value's big endian representation. Must not be null.
use - The key use. null if not specified.
alg - The intended JOSE algorithm for the key, null if not specified.
kid - The key ID. null if not specified.
Method Detail

getModulus

public Base64URL getModulus()
Returns the modulus value for this RSA public key. It is represented as the Base64URL encoding of the value's big ending representation.

Returns:
The RSA public key modulus.

getExponent

public Base64URL getExponent()
Returns the exponent value for this RSA public key. It is represented as the Base64URL encoding of the value's big ending representation.

Returns:
The RSA public key exponent.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
Description copied from class: JWK
Returns a JSON object representation of this JWK. This method is intended to be called from extending classes.

Example:

 {
   "kty" : "RSA",
   "use" : "sig",
   "kid" : "fd28e025-8d24-48bc-a51a-e2ffc8bc274b"
 }
 

Overrides:
toJSONObject in class JWK
Returns:
The JSON object representation.

parse

public static RSAKey parse(net.minidev.json.JSONObject jsonObject)
                    throws ParseException
Parses a public RSA JWK from the specified JSON object representation.

Parameters:
jsonObject - The JSON object to parse. Must not be
Returns:
The RSA Key.
Throws:
ParseException - If the JSON object couldn't be parsed to valid RSA JWK.


Copyright © 2013 NimbusDS. All Rights Reserved.