- java.lang.Object
-
- dev.netcode.security.identity.Signature
-
public class Signature extends java.lang.ObjectSignatures can be used to add prove to an Identity that the contained data either comes from or was checked by a specific person, institution or service
-
-
Constructor Summary
Constructors Constructor Description Signature(java.lang.String issuerName, java.lang.String issuerIdentityID, java.lang.String dataHash)Creates a raw signature that is not signed yet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetVerifiableDataString()booleanisValid(java.security.PublicKey publicKey, Identity identity)Checks the validity of the signaturevoidsign(java.security.PrivateKey privateKey)Signs this Signature which makes it valid.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Signature
public Signature(java.lang.String issuerName, java.lang.String issuerIdentityID, java.lang.String dataHash)Creates a raw signature that is not signed yet.- Parameters:
issuerName- name of the issuerissuerIdentityID- unique identifier of the issuerdataHash- of the data to be signed
-
-
Method Detail
-
isValid
public boolean isValid(java.security.PublicKey publicKey, Identity identity)Checks the validity of the signature- Parameters:
publicKey- of the instance that should have signed the dataidentity- the signature should belong to- Returns:
- true if the signature is valid and belongs to the given identity
-
sign
public void sign(java.security.PrivateKey privateKey)
Signs this Signature which makes it valid.- Parameters:
privateKey- used to sign the signature
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getVerifiableDataString
public java.lang.String getVerifiableDataString()
- Returns:
- all the data contained in the signature that is verifiable
-
-