Class COSEEC2Key
-
Constructor Summary
ConstructorsConstructorDescriptionCOSEEC2Key(List<? extends CBORPair> pairs) A constructor with key parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddJwkProperties(Map<String, Object> map) Add JWK properties to the given map.Create aPrivateKeyinstance from this COSE key.Create aPublicKeyinstance from this COSE key.getCrv()Get the curve (the value of thecrvparameter).byte[]getD()Get the private key (the value of thedparameter).byte[]getX()Get the x-coordinate (the value of thexparameter).getY()Get the y-coordinate (the value of theyparameter).booleanGet the flag indicating whether this key contains private parameters.Convert thisCOSEEC2Keyinstance to anECPrivateKeyinstance.Convert thisCOSEEC2Keyinstance to anECPublicKeyinstance.toPublic()Convert this COSE key to a public key.Methods inherited from class com.authlete.cose.COSEKey
build, build, copy, fromJwk, getAlg, getBaseIv, getKeyOps, getKid, getKty, getParameters, toJwkMethods inherited from class com.authlete.cbor.CBORPairList
encode, findByKey, getPairs, parse, prettify, toStringMethods inherited from class com.authlete.cbor.CBORItem
encode, encodeMajorWithNumber, encodeToBase64, encodeToBase64Url, encodeToHex, getComment, prettify, setComment, toString
-
Constructor Details
-
COSEEC2Key
-
-
Method Details
-
isPrivate
-
toPublic
Description copied from class:COSEKeyConvert this COSE key to a public key.When this
COSEKeyinstance is a public key, this method returnsthisobject without any modification. Otherwise, this method creates a newCOSEKeyinstance representing a public key and returns the new instance.The default implementation of this method throws an exception. Subclasses should override this method.
- Overrides:
toPublicin classCOSEKey- Returns:
- A
COSEKeyinstance representing a public key. - Throws:
COSEException
-
addJwkProperties
Description copied from class:COSEKeyAdd JWK properties to the given map.This method is called from within the
COSEKey.toJwk()method. Subclasses of theCOSEKeyclass should override this method.- Overrides:
addJwkPropertiesin classCOSEKey- Parameters:
map- A map to which JWK properties should be added.
-
getCrv
Get the curve (the value of thecrvparameter).The type of the value is an integer (
int,longorBigInteger) or a string (String).- Returns:
- The curve.
- See Also:
-
getX
public byte[] getX()Get the x-coordinate (the value of thexparameter).- Returns:
- The x-coordinate.
-
getY
Get the y-coordinate (the value of theyparameter).The type of the value is either a byte array (
byte[]) or boolean (Boolean). When the point is compressed, the y-coordinate is represented by using a single bit. See "2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion" and "2.3.4 Octet-String-to-Elliptic-Curve-Point Conversion" in "SEC 1: Elliptic Curve Cryptography" for details.- Returns:
- The y-coordinate.
- See Also:
-
getD
public byte[] getD()Get the private key (the value of thedparameter).- Returns:
- The private key.
-
toECPrivateKey
Convert thisCOSEEC2Keyinstance to anECPrivateKeyinstance.- Returns:
- A new
ECPrivateKeyinstance. - Throws:
COSEException
-
toECPublicKey
Convert thisCOSEEC2Keyinstance to anECPublicKeyinstance.- Returns:
- A new
ECPublicKeyinstance. - Throws:
COSEException
-
createPrivateKey
Description copied from class:COSEKeyCreate aPrivateKeyinstance from this COSE key.The default implementation of this method throws an exception. Subclasses should override this method.
- Overrides:
createPrivateKeyin classCOSEKey- Returns:
- A
PrivateKeyinstance. - Throws:
COSEException- The creation failed.
-
createPublicKey
Description copied from class:COSEKeyCreate aPublicKeyinstance from this COSE key.The default implementation of this method throws an exception. Subclasses should override this method.
- Overrides:
createPublicKeyin classCOSEKey- Returns:
- A
PublicKeyinstance. - Throws:
COSEException- The creation failed.
-