Class JwkMetadataProperties
java.lang.Object
se.swedenconnect.security.credential.nimbus.JwkMetadataProperties
Symbolic constants for storing JWK properties in a
PkiCredential.Metadata object. The class also offers
utility methods for setting and getting JWK related properties.- Author:
- Martin Lindström
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic AlgorithmgetJoseAlgorithm(PkiCredential.Metadata metadata) Gets the value of the "jose-alg" property.static Set<KeyOperation> getKeyOps(PkiCredential.Metadata metadata) Gets the value for the "key-ops" property.static KeyUsegetKeyUse(PkiCredential.Metadata metadata) Gets the value of the "key-use".static voidsetJoseAlgorithm(PkiCredential.Metadata metadata, Algorithm joseAlgorithm) Utility method that assigns the "jose-alg".static voidsetJoseAlgorithm(PkiCredential.Metadata metadata, String joseAlgorithm) Utility method that assigns the "jose-alg".static voidsetKeyOps(PkiCredential.Metadata metadata, String keyOps) Utility method that assigns the "key-ops".static voidsetKeyOps(PkiCredential.Metadata metadata, List<String> keyOps) Utility method that assigns the "key-ops".static voidsetKeyOps(PkiCredential.Metadata metadata, Set<KeyOperation> keyOps) Utility method that assigns the "key-ops".static voidsetKeyUse(PkiCredential.Metadata metadata, KeyUse keyUse) Utility method that is used to assign the "key-use" property.static voidsetKeyUse(PkiCredential.Metadata metadata, String keyUse) Utility method that is used to assign the "key-use" property.
-
Field Details
-
KEY_USE_PROPERTY
Property name for the key use metadata property. Maps to JWK'suseproperty. Should hold aKeyUseor aString.- See Also:
-
KEY_OPS_PROPERTY
Property name for the key operations metadata property. Maps to JWK'sopsproperty. Should hold aSetofKeyOperations or a comma-separated list ofStrings.- See Also:
-
JOSE_ALGORITHM_PROPERTY
Property name for the JOSE algorithm metadata property. Maps to JWK'salgproperty. Should hold aAlgorithmor aStringrepresentation.- See Also:
-
-
Method Details
-
setKeyUse
Utility method that is used to assign the "key-use" property. SeesetKeyUse(PkiCredential.Metadata, KeyUse).- Parameters:
metadata- theMetadataobjectkeyUse- the key use string
-
setKeyUse
Utility method that is used to assign the "key-use" property.As a side-effect, the method will also update the
If the suppliedPkiCredential.Metadata.USAGE_PROPERTY.KeyUse.SIGNATUREmaps toPkiCredential.Metadata.USAGE_SIGNINGandKeyUse.ENCRYPTIONmaps toPkiCredential.Metadata.USAGE_ENCRYPTION.KeyUseisKeyUse.SIGNATUREorKeyUse.ENCRYPTION- Parameters:
metadata- theMetadataobjectkeyUse- the key use
-
getKeyUse
Gets the value of the "key-use".If no value is stored for the "key-use", but a value exists for
PkiCredential.Metadata.USAGE_PROPERTY, this value is mapped to aKeyUse. -
setKeyOps
public static void setKeyOps(@Nonnull PkiCredential.Metadata metadata, @Nullable List<String> keyOps) throws IllegalArgumentException Utility method that assigns the "key-ops". SeesetKeyOps(PkiCredential.Metadata, Set).- Parameters:
metadata- theMetadataobjectkeyOps- a list of key operations (ornullfor resetting the property)- Throws:
IllegalArgumentException- for invalid key operations, seeKeyOperation.parse(List)
-
setKeyOps
public static void setKeyOps(@Nonnull PkiCredential.Metadata metadata, @Nullable String keyOps) throws IllegalArgumentException Utility method that assigns the "key-ops". SeesetKeyOps(PkiCredential.Metadata, Set).- Parameters:
metadata- theMetadataobjectkeyOps- a comma-separated list of key operation strings (ornullfor resetting the property)- Throws:
IllegalArgumentException- for invalid key operations, seeKeyOperation.parse(List)
-
setKeyOps
public static void setKeyOps(@Nonnull PkiCredential.Metadata metadata, @Nullable Set<KeyOperation> keyOps) Utility method that assigns the "key-ops".- Parameters:
metadata- theMetadataobjectkeyOps- a set of key operations (ornullfor resetting the property)
-
getKeyOps
Gets the value for the "key-ops" property.- Parameters:
metadata- theMetadataobject- Returns:
- a set of
KeyOperations, ornull
-
setJoseAlgorithm
public static void setJoseAlgorithm(@Nonnull PkiCredential.Metadata metadata, @Nullable String joseAlgorithm) Utility method that assigns the "jose-alg".- Parameters:
metadata- theMetadataobjectjoseAlgorithm- the string representation of the JOSE algorithm
-
setJoseAlgorithm
public static void setJoseAlgorithm(@Nonnull PkiCredential.Metadata metadata, @Nullable Algorithm joseAlgorithm) Utility method that assigns the "jose-alg". SeesetJoseAlgorithm(PkiCredential.Metadata, String).- Parameters:
metadata- theMetadataobjectjoseAlgorithm- the JOSE algorithm
-
getJoseAlgorithm
Gets the value of the "jose-alg" property.
-