I want to look at libraries that can implement crypto functions to validate digital signatures.
Is there any built-in function to validate digital signature in Daml?
127 Views Asked by Prachi Gupta At
3
There are 3 best solutions below
0

There's no built-in function to validate signatures in Daml. All signature validation happens through the signatory declaration on templates which should be flexible enough via various patterns to handle signatures validation however you need.
0

If you are using DAML, below is the code to accept crypto coin issued, here you can add your conditional verify or check coinAgreement.issuer
go here
For e.g. verify he is both issuer and owner
coinIssuerVerify <- queryFilter @coinIssuerVerify issuer
(\cI -> (cI.issuer == issuer) && (cI.owner == owner))
template CoinIssue
with
coinAgreement: CoinIssueAgreement
where
signatory coinAgreement.issuer
controller coinAgreement.owner can
AcceptCoinProposal
: ContractId CoinIssueAgreement
do create coinAgreement
It would be helpful to understand what you're trying to achieve with signature verification.
In cryptocurrencies, public cryptographic primitives are needed since public keys define the identity, in other words the signatures need to be verifiable publicly. In Daml this is usually not needed, since
party
defines the identity and most information is inherently private to some group. As such, public verification isn't a common use case.One way to use cryptographic primitives alongside Daml is to have clients of the Ledger API(s) sign and verify signatures. For example, if I want to authenticate that a specific human is performing an action based on a smart card in their possession, part of the workflow could include:
verifier
create a random nonce as a challenge which is written to a contractalice
use her smart card to sign the nonce and submitting the signature as a choice parameterverifier
validate the signature in order to progress the workflow