public void SignWithSHA512Test() { using (Pkcs11RsaSignature pkcs11RsaSignature = new Pkcs11RsaSignature(_libraryPath, _tokenSerial, _tokenLabel, _pin, _ckaLabel, _ckaId, HashAlgorithm.SHA512)) { byte[] signature = pkcs11RsaSignature.Sign(ConvertUtils.Utf8StringToBytes("Hello world")); Assert.IsTrue(pkcs11RsaSignature.GetEncryptionAlgorithm() == "RSA"); Assert.IsTrue(pkcs11RsaSignature.GetHashAlgorithm() == "SHA512"); Assert.IsTrue(ConvertUtils.BytesToBase64String(signature) == @"nfTYFqxGibgo6Gf5I9AYSVIHyZrCCN1xS8QQkaWVx1JE6pJS0p4urlDTE5RshYBNQ1xxoxTzKpKk5z1TBj0Bzmx0lvhjFpMELW/47xxkYNeBMbfauIIKy2wjvIAlZ1STEGOc622tyPNC9XS9phiJpnmtzOLzetIMwJM+/xCyqLWZmRPilE2luu63w2b60vnfHKSDFeeqtxCd5vvkXsp8iz1A2xLxqEVVrCyQR9qJMAKT5KrApuEHxTLuqqBPO9jV4oFoAu2a+nFlTXk//aU0YfDqsTBeuf2DzhnLAajV3wdCTuKxMlR6jhzXwANLvcq5N8L1Fr7gfj9VX/tuRfNgEw=="); } }
public void SignWithSHA256Test() { using (Pkcs11RsaSignature pkcs11RsaSignature = new Pkcs11RsaSignature(_libraryPath, _tokenSerial, _tokenLabel, _pin, _ckaLabel, _ckaId, HashAlgorithm.SHA256)) { byte[] signature = pkcs11RsaSignature.Sign(ConvertUtils.Utf8StringToBytes("Hello world")); Assert.IsTrue(pkcs11RsaSignature.GetEncryptionAlgorithm() == "RSA"); Assert.IsTrue(pkcs11RsaSignature.GetHashAlgorithm() == "SHA256"); Assert.IsTrue(ConvertUtils.BytesToBase64String(signature) == @"TL4ZfPMONv5EFO1cI8ni8YuOkPB/0XXjCQPSHH7r3NejQpNCWD0P4OHRIIYYOMYjJwwRbstS+zX5YigR7Wo8j3OrNs5/H3e9k0OcIidM4WFVz7h5frMmaLo+kbVwnA8zGAaYiXAxgQGHH1Qr31pYkVifWx6/Wq+/J4iKVLXFr25mrIwg/Ccfar587HMi3KzPYYNtKIglkqTTTqrzxBv+VW9Ty2TB+YbTJ/3FsBz6+PWHLPCrECizvCKZyT56EOj6QkJ6bZSMt6N42ng187ZgnatwjYJd3HitX146qNpoR5Hp2yjPSBgxxww/U66O2v1SQV1fBz/bGpQ/t6JLODkAmA=="); } }
public void SignWithSHA384Test() { using (Pkcs11RsaSignature pkcs11RsaSignature = new Pkcs11RsaSignature(_libraryPath, _tokenSerial, _tokenLabel, _pin, _ckaLabel, _ckaId, HashAlgorithm.SHA384)) { byte[] signature = pkcs11RsaSignature.Sign(ConvertUtils.Utf8StringToBytes("Hello world")); Assert.IsTrue(pkcs11RsaSignature.GetEncryptionAlgorithm() == "RSA"); Assert.IsTrue(pkcs11RsaSignature.GetHashAlgorithm() == "SHA384"); Assert.IsTrue(ConvertUtils.BytesToBase64String(signature) == @"cuI+JqxscNrX1ZK/PtyTTJmWsRttSivokif2RkbhiAcgXS/6VxDGup83BGMwy+Yttv9miqrPY/dp0GB4TcAbWoYsXhKB+zTs3BlCAvHrDobpvz/wkhLry7AsAjCFUt9ax2ySfAU3PyUkKRkD2WwlDV3DVwAdKZhfkElL8ocYfoAod5u2X8/78HDVod9umUf8Yj1MI0xPdtaOTO1YLWS3Pd9TgXI0IuzbtY/QYO79PVaaalzZYROIy+kwJkkE/N9nQMRg2BVxSEvkd29/Vv98Z/OMDDVFga26BsYhhS9KUw8lKnk7qk7QvSKbPDvhQmTMwNfL++Yi2E4Df8bVk2O1JA=="); } }
public void SignWithSHA1Test() { using (Pkcs11RsaSignature pkcs11RsaSignature = new Pkcs11RsaSignature(_libraryPath, _tokenSerial, _tokenLabel, _pin, _ckaLabel, _ckaId, HashAlgorithm.SHA1)) { byte[] signature = pkcs11RsaSignature.Sign(ConvertUtils.Utf8StringToBytes("Hello world")); Assert.IsTrue(pkcs11RsaSignature.GetEncryptionAlgorithm() == "RSA"); Assert.IsTrue(pkcs11RsaSignature.GetHashAlgorithm() == "SHA1"); Assert.IsTrue(ConvertUtils.BytesToBase64String(signature) == @"ANaql6sPuTp25Is2V6boFuTwIrBJ7eiM+z4OxcfHIHWiQ1SnBGfpFFdXfnpklTdwYenRpFxaHW6KlNYEIRk9Jkc0ZAJI83QYMmB99mdbnFLxVWqfpO9+41nOv08oe1RZxLp69pWUF0W1yFPwWmB/azH1x3wLkQlLTmxfCo7IEA7v+wlWZn5OosLVL2RjHMAKEcLBbcz9GuEC+BFAiFGRQCVZhWH0k5BgL38cG+Y0PMo+NH2LQy9Hh0neC+3VsQpQgHJM7n5H0/ck1Oay5jSv29I+PoiUMCmEg6txjElYvsrGEB6GwCuO1o5TwjqlADi+KeKqiH3BsIrTS0NTejLW9Q=="); } }