- All Implemented Interfaces:
WebCertificateReference
,WebKey
,WebKeyReference
JSON Web Key (JWK) implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.iu.crypt.WebCertificateReference
WebCertificateReference.Builder<B extends WebCertificateReference.Builder<B>>
Nested classes/interfaces inherited from interface edu.iu.crypt.WebKey
WebKey.Algorithm, WebKey.Builder<B extends WebKey.Builder<B>>, WebKey.Operation, WebKey.Type, WebKey.Use
Nested classes/interfaces inherited from interface edu.iu.crypt.WebKeyReference
WebKeyReference.Builder<B extends WebKeyReference.Builder<B>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonObject
SerializesWebKey
s as a JSON Web Key Set.boolean
byte[]
getKey()
Gets the raw key data for use whenWebKey.Type.RAW
.getOps()
Gets the key operations.Gets the JCE private key implementation.Gets the JCE public key implementation.getType()
Gets the key type.getUse()
Gets the public key use.int
hashCode()
parseJwks
(JsonObject jwks) Parses a JSON Web Key Set (JWKS).readJwks
(InputStream in) Reads a key set from an input stream.Gets key set by URI.(package private) boolean
represents
(Jwk key) Determines whether or not the known components of this key match the known components of another key.serializeTo
(JsonObjectBuilder jwkBuilder) Adds serialized JWK attributes to a JSON object builder.toString()
Returns a copy of this key for whichWebKey.getPrivateKey()
andWebKey.getKey()
always return null, and for which the source data backing these methods is not populated.static void
writeJwks
(Iterable<? extends WebKey> webKeys, OutputStream out) WritesWebKey
as a JSON Web Key.Methods inherited from class iu.crypt.JsonKeyReference
getAlgorithm, getKeyId
Methods inherited from class iu.crypt.JsonCertificateReference
getCertificateChain, getCertificateSha256Thumbprint, getCertificateThumbprint, getCertificateUri, verifiedCertificateChain
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.iu.crypt.WebCertificateReference
getCertificateChain, getCertificateSha256Thumbprint, getCertificateThumbprint, getCertificateUri
Methods inherited from interface edu.iu.crypt.WebKeyReference
getAlgorithm, getKeyId
-
Constructor Details
-
Jwk
Constructor.- Parameters:
jwk
- parsed JWK parameters
-
-
Method Details
-
readJwks
Gets key set by URI.- Parameters:
uri
- Key set URI- Returns:
- key set
-
readJwks
Reads a key set from an input stream.- Parameters:
in
- input stream- Returns:
WebKey
-
parseJwks
Parses a JSON Web Key Set (JWKS).- Parameters:
jwks
- serialized JWKS- Returns:
- parsed key set
-
asJwks
SerializesWebKey
s as a JSON Web Key Set.- Parameters:
webKeys
-WebKey
s- Returns:
- serialized JWKS
-
writeJwks
WritesWebKey
as a JSON Web Key.- Parameters:
webKeys
-WebKey
sout
-OutputStream
-
getType
Description copied from interface:WebKey
Gets the key type. -
getUse
Description copied from interface:WebKey
Gets the public key use. -
getKey
public byte[] getKey()Description copied from interface:WebKey
Gets the raw key data for use whenWebKey.Type.RAW
. -
getPublicKey
Description copied from interface:WebKey
Gets the JCE public key implementation.- Specified by:
getPublicKey
in interfaceWebKey
- Returns:
PublicKey
-
getPrivateKey
Description copied from interface:WebKey
Gets the JCE private key implementation.- Specified by:
getPrivateKey
in interfaceWebKey
- Returns:
PrivateKey
-
getOps
Description copied from interface:WebKey
Gets the key operations. -
wellKnown
Description copied from interface:WebKey
Returns a copy of this key for whichWebKey.getPrivateKey()
andWebKey.getKey()
always return null, and for which the source data backing these methods is not populated.If these methods would already return null, this key is returned as-is.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classJsonKeyReference<Jwk>
-
equals
- Overrides:
equals
in classJsonKeyReference<Jwk>
-
toString
- Overrides:
toString
in classJsonCertificateReference<Jwk>
-
serializeTo
Adds serialized JWK attributes to a JSON object builder.- Overrides:
serializeTo
in classJsonKeyReference<Jwk>
- Parameters:
jwkBuilder
-JsonObjectBuilder
- Returns:
- jwkBuilder
-
represents
Determines whether or not the known components of this key match the known components of another key.- Overrides:
represents
in classJsonKeyReference<Jwk>
- Parameters:
key
-WebKey
- Returns:
- true if all non-null components of both keys match
-