Class Signature

java.lang.Object
dev.netcode.security.identity.Signature

public class Signature extends Object
Signatures 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 Details

    • Signature

      public Signature(String issuerName, String issuerIdentityID, String dataHash)
      Creates a raw signature that is not signed yet.
      Parameters:
      issuerName - name of the issuer
      issuerIdentityID - unique identifier of the issuer
      dataHash - of the data to be signed
  • Method Details

    • isValid

      public boolean isValid(PublicKey publicKey, Identity identity)
      Checks the validity of the signature
      Parameters:
      publicKey - of the instance that should have signed the data
      identity - the signature should belong to
      Returns:
      true if the signature is valid and belongs to the given identity
    • sign

      public void sign(PrivateKey privateKey)
      Signs this Signature which makes it valid.
      Parameters:
      privateKey - used to sign the signature
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getVerifiableDataString

      public String getVerifiableDataString()
      Returns:
      all the data contained in the signature that is verifiable