Class COSEVerifier
java.lang.Object
com.authlete.cose.COSEVerifier
-
Constructor Summary
ConstructorsConstructorDescriptionCOSEVerifier(KeyGetter keyGetter) A constructor with a key getter that is called later when verification is performed.COSEVerifier(Key key) A constructor with a public key for verification. -
Method Summary
Modifier and TypeMethodDescriptionbooleanVerify aCOSE_Signobject.booleanVerify aCOSE_Sign1object.booleanVerify aCOSE_Sign1object.booleanVerify aCOSE_Signobject.booleanverify(COSESign sign, COSESignature signature) Verify a combination ofCOSE_SignandCOSE_Signature.booleanverify(COSESign sign, COSESignature signature, byte[] externalData) Verify a combination ofCOSE_SignandCOSE_Signature.static booleanVerify the signature for the data with the key and the algorithm.
-
Constructor Details
-
COSEVerifier
A constructor with a public key for verification.- Parameters:
key- A public key for verification. Must not be null.
-
COSEVerifier
A constructor with a key getter that is called later when verification is performed.When verification is performed, the
getmethod of the key getter is called with the first argumentCOSEKeyOperations.VERIFY.- Parameters:
keyGetter- A key getter that returns a public key for verification. Must not be null.
-
-
Method Details
-
verify
Verify aCOSE_Signobject.This method is an alias of
verify(sign, (byte[])null).- Parameters:
sign- ACOSE_Signobject to verify.- Returns:
trueif any of signatures in theCOSE_Signobject is valid.falseif none of signatures in theCOSE_Signobject are valid.- Throws:
COSEException
-
verify
Verify aCOSE_Signobject.- Parameters:
sign- ACOSE_Signobject to verify.externalData- Optional external data.- Returns:
trueif any of signatures in theCOSE_Signobject is valid.falseif none of signatures in theCOSE_Signobject are valid.- Throws:
COSEException
-
verify
Verify a combination ofCOSE_SignandCOSE_Signature.This method is an alias of
verify(sign, signature, (byte[])null).- Parameters:
sign- ACOSE_Signobject to verify.signature- ACOSE_Signatureobject to verify.- Returns:
trueif the signature of theCOSE_Signatureobject is valid.falseif the signature is invalid.- Throws:
COSEException
-
verify
public boolean verify(COSESign sign, COSESignature signature, byte[] externalData) throws COSEException Verify a combination ofCOSE_SignandCOSE_Signature.This method is called repeatedly from within
verify(COSESign, byte[])for eachCOSE_Signatureobject in theCOSE_Signobject.- Parameters:
sign- ACOSE_Signobject to verify.signature- ACOSE_Signatureobject to verify.externalData- Optional external data.- Returns:
trueif the signature of theCOSE_Signatureobject is valid.falseif the signature is invalid.- Throws:
COSEException
-
verify
Verify aCOSE_Sign1object.This method is an alias of
verify(sign1, (byte[])null).- Parameters:
sign1- ACOSE_Sign1object to verify.- Returns:
trueif the signature of theCOSE_Sign1object is valid.falseif the signature is invalid.- Throws:
COSEException
-
verify
Verify aCOSE_Sign1object.- Parameters:
sign1- ACOSE_Sign1object to verify.externalData- Optional external data.- Returns:
trueif the signature of theCOSE_Sign1object is valid.falseif the signature is invalid.- Throws:
COSEException
-
verify
Verify the signature for the data with the key and the algorithm.This method can be used for general purposes without depending on COSE data structures such as
COSE_SignandCOSE_Sign1.- Parameters:
key- A public key for verification.alg- The integer identifier of an algorithm such as -7 (which meansES256). Identifiers are listed in IANA: COSE Algorithms.data- Data for which the signature was generated.signature- A signature to verify.- Returns:
trueif the signature is valid.falseif the signature is invalid.- Throws:
COSEException
-