JsonWebKey Class
- java.
lang. Object - com.
azure. security. keyvault. keys. models. JsonWebKey
- com.
Implements
public class JsonWebKey
implements JsonSerializable<JsonWebKey>
Constructor Summary
Constructor | Description |
---|---|
JsonWebKey() |
Creates a new instance of JsonWebKey. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
clearMemory()
Clear key materials. |
boolean |
equals(JsonWebKey jwk)
Indicates whether some other JsonWebKey is "equal to" this one. |
boolean | equals(Object obj) |
static
Json |
fromAes(SecretKey secretKey)
Converts AES key to JSON web key. |
static
Json |
fromAes(SecretKey secretKey, List<KeyOperation> keyOperations)
Converts AES key to JSON web key. |
static
Json |
fromEc(KeyPair keyPair, Provider provider)
Converts EC key pair to JSON web key. |
static
Json |
fromEc(KeyPair keyPair, Provider provider, List<KeyOperation> keyOperations)
Converts EC key pair to JSON web key. |
static
Json |
fromJson(JsonReader jsonReader)
Reads a JSON stream into a JsonWebKey. |
static
Json |
fromRsa(KeyPair keyPair)
Converts RSA key pair to JSON web key. |
static
Json |
fromRsa(KeyPair keyPair, List<KeyOperation> keyOperations)
Converts RSA key pair to JSON web key. |
Key |
getCurveName()
Get the crv value. |
byte[] |
getD()
Get the d value. |
byte[] |
getDp()
Get the RSA Private Key Parameter value. |
byte[] |
getDq()
Get the RSA Private Key Parameter value. |
byte[] |
getE()
Get the e value. |
String |
getId()
Get the kid value. |
byte[] |
getK()
Get Symmetric key value. |
List<Key |
getKeyOps()
Get the immutable key operations list. |
Key |
getKeyType()
Get the kty value. |
byte[] |
getN()
Get the n value. |
byte[] |
getP()
Get the RSA secret prime value. |
byte[] |
getQ()
Get RSA secret prime, with p < q value. |
byte[] |
getQi()
Get the RSA Private Key Parameter value. |
byte[] |
getT()
Get HSM Token value, used with Bring Your Own Key. |
byte[] |
getX()
Get the x value. |
byte[] |
getY()
Get the y value. |
boolean |
hasPrivateKey()
Verifies whether the JsonWebKey has private key. |
int | hashCode() |
boolean |
isValid()
Verifies whether the JsonWebKey is valid. |
Json |
setCurveName(KeyCurveName crv)
Set the crv value. |
Json |
setD(byte[] d)
Set the d value. |
Json |
setDp(byte[] dp)
Set RSA Private Key Parameter value. |
Json |
setDq(byte[] dq)
Set RSA Private Key Parameter value . |
Json |
setE(byte[] e)
Set the e value. |
Json |
setId(String keyId)
Set the key identifier value. |
Json |
setK(byte[] k)
Set the Symmetric key value. |
Json |
setKeyOps(List<KeyOperation> keyOps)
Set the key |
Json |
setKeyType(KeyType keyType)
Set the key type value. |
Json |
setN(byte[] n)
Set the n value. |
Json |
setP(byte[] p)
Set the RSA secret prime value. |
Json |
setQ(byte[] q)
Set the RSA secret prime, with p < q value. |
Json |
setQi(byte[] qi)
Set RSA Private Key Parameter value. |
Json |
setT(byte[] t)
Set HSM Token value, used with Bring Your Own Key. |
Json |
setX(byte[] x)
Set the x value. |
Json |
setY(byte[] y)
Set the y value. |
Secret |
toAes()
Converts JSON web key to AES key. |
Key |
toEc()
Converts JSON web key to EC key pair and include the private key if set to true. |
Key |
toEc(boolean includePrivateParameters)
Converts JSON web key to EC key pair and include the private key if set to true. |
Key |
toEc(boolean includePrivateParameters, Provider provider)
Converts JSON web key to EC key pair and include the private key if set to true. |
Json |
toJson(JsonWriter jsonWriter) |
Key |
toRsa()
Converts JSON web key to RSA key pair. |
Key |
toRsa(boolean includePrivateParameters)
Converts JSON web key to RSA key pair and include the private key if set to true. |
Key |
toRsa(boolean includePrivateParameters, Provider provider)
Converts JSON web key to RSA key pair and include the private key if set to true. |
String | toString() |
Methods inherited from java.lang.Object
Constructor Details
JsonWebKey
public JsonWebKey()
Creates a new instance of JsonWebKey.
Method Details
clearMemory
public void clearMemory()
Clear key materials.
equals
public boolean equals(JsonWebKey jwk)
Indicates whether some other JsonWebKey is "equal to" this one.
Parameters:
Returns:
equals
public boolean equals(Object obj)
Overrides:
JsonWebKey.equals(Object obj)Parameters:
fromAes
public static JsonWebKey fromAes(SecretKey secretKey)
Converts AES key to JSON web key.
Parameters:
Returns:
fromAes
public static JsonWebKey fromAes(SecretKey secretKey, List
Converts AES key to JSON web key.
Parameters:
Returns:
fromEc
public static JsonWebKey fromEc(KeyPair keyPair, Provider provider)
Converts EC key pair to JSON web key.
Parameters:
Returns:
fromEc
public static JsonWebKey fromEc(KeyPair keyPair, Provider provider, List
Converts EC key pair to JSON web key.
Parameters:
Returns:
fromJson
public static JsonWebKey fromJson(JsonReader jsonReader)
Reads a JSON stream into a JsonWebKey.
Parameters:
Returns:
Throws:
fromRsa
public static JsonWebKey fromRsa(KeyPair keyPair)
Converts RSA key pair to JSON web key.
Parameters:
Returns:
fromRsa
public static JsonWebKey fromRsa(KeyPair keyPair, List
Converts RSA key pair to JSON web key.
Parameters:
Returns:
getCurveName
public KeyCurveName getCurveName()
Get the crv value.
Returns:
getD
public byte[] getD()
Get the d value.
Returns:
getDp
public byte[] getDp()
Get the RSA Private Key Parameter value.
Returns:
getDq
public byte[] getDq()
Get the RSA Private Key Parameter value.
Returns:
getE
public byte[] getE()
Get the e value.
Returns:
getId
public String getId()
Get the kid value.
Returns:
getK
public byte[] getK()
Get Symmetric key value.
Returns:
getKeyOps
public List
Get the immutable key operations list. The list cannot be modified.
Returns:
getKeyType
public KeyType getKeyType()
Get the kty value.
Returns:
getN
public byte[] getN()
Get the n value.
Returns:
getP
public byte[] getP()
Get the RSA secret prime value.
Returns:
getQ
public byte[] getQ()
Get RSA secret prime, with p < q value.
Returns:
getQi
public byte[] getQi()
Get the RSA Private Key Parameter value.
Returns:
getT
public byte[] getT()
Get HSM Token value, used with Bring Your Own Key.
Returns:
getX
public byte[] getX()
Get the x value.
Returns:
getY
public byte[] getY()
Get the y value.
Returns:
hasPrivateKey
public boolean hasPrivateKey()
Verifies whether the JsonWebKey has private key.
Returns:
hashCode
public int hashCode()
Overrides:
JsonWebKey.hashCode()isValid
public boolean isValid()
Verifies whether the JsonWebKey is valid.
Returns:
setCurveName
public JsonWebKey setCurveName(KeyCurveName crv)
Set the crv value.
Parameters:
Returns:
setD
public JsonWebKey setD(byte[] d)
Set the d value.
Parameters:
Returns:
setDp
public JsonWebKey setDp(byte[] dp)
Set RSA Private Key Parameter value.
Parameters:
Returns:
setDq
public JsonWebKey setDq(byte[] dq)
Set RSA Private Key Parameter value .
Parameters:
Returns:
setE
public JsonWebKey setE(byte[] e)
Set the e value.
Parameters:
Returns:
setId
public JsonWebKey setId(String keyId)
Set the key identifier value.
Parameters:
Returns:
setK
public JsonWebKey setK(byte[] k)
Set the Symmetric key value.
Parameters:
Returns:
setKeyOps
public JsonWebKey setKeyOps(List
Set the keyOps value.
Parameters:
Returns:
setKeyType
public JsonWebKey setKeyType(KeyType keyType)
Set the key type value.
Parameters:
Returns:
setN
public JsonWebKey setN(byte[] n)
Set the n value.
Parameters:
Returns:
setP
public JsonWebKey setP(byte[] p)
Set the RSA secret prime value.
Parameters:
Returns:
setQ
public JsonWebKey setQ(byte[] q)
Set the RSA secret prime, with p < q value.
Parameters:
Returns:
setQi
public JsonWebKey setQi(byte[] qi)
Set RSA Private Key Parameter value.
Parameters:
Returns:
setT
public JsonWebKey setT(byte[] t)
Set HSM Token value, used with Bring Your Own Key.
Parameters:
Returns:
setX
public JsonWebKey setX(byte[] x)
Set the x value.
Parameters:
Returns:
setY
public JsonWebKey setY(byte[] y)
Set the y value.
Parameters:
Returns:
toAes
public SecretKey toAes()
Converts JSON web key to AES key.
Returns:
toEc
public KeyPair toEc()
Converts JSON web key to EC key pair and include the private key if set to true.
Returns:
toEc
public KeyPair toEc(boolean includePrivateParameters)
Converts JSON web key to EC key pair and include the private key if set to true.
Parameters:
Returns:
toEc
public KeyPair toEc(boolean includePrivateParameters, Provider provider)
Converts JSON web key to EC key pair and include the private key if set to true.
Parameters:
Returns:
toJson
toRsa
public KeyPair toRsa()
Converts JSON web key to RSA key pair.
Returns:
toRsa
public KeyPair toRsa(boolean includePrivateParameters)
Converts JSON web key to RSA key pair and include the private key if set to true.
Parameters:
Returns:
toRsa
public KeyPair toRsa(boolean includePrivateParameters, Provider provider)
Converts JSON web key to RSA key pair and include the private key if set to true.
Parameters:
Returns:
toString
public String toString()
Overrides:
JsonWebKey.toString()Applies to
Azure SDK for Java