Sign and SignVerify Data using an EC Key
To Sign and SignVerify data using an EC key:
Create a NAE Session. Pass the NAE username, password, property file path as arguments.
NaeSession session = new NaeSession(user, passwd, propFilePath);Create
NaeECIESKeyobject. PassNaeSessionobject and curve as argument.NaeECIESKey ecKey = new NaeECIESKey (session, curve);Curve can be set to
NaeECIESKey.SupportedCurves.brainpoolP256r1_256Set the Hash algorithm.
HashAlgorithmName algorithm = HashAlgorithmName.SHA256;Call the
SignDataAPI and pass input bytes, hashing algorithm name as arguments to get the signed bytes.byte[] outBytes = ecKey.SignData(inputBytes, hashalgorithm);Call the
VerifyDataAPI. Pass the signed bytes, input bytes, offset, count, and hashing algorithm name as arguments for the verification of signed data.bool result = ecKey.VerifyData(inputBytes, offset, count, outBytes, hashalgorithm);