如何存储和比较使用非对称算法生成的加密字符串? [英] How to store and compare encrypted string generated using asymmetric algorithm?

查看:98
本文介绍了如何存储和比较使用非对称算法生成的加密字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将RSA算法生成的加密字符串存储在数据库中。据我所知,由于随机填充rsa将每次为相同的纯文本生成不同的加密字符串。有没有办法在c#和sql中存储和比较这些值?



我尝试过:



我使用默认的rsacryptoserviceprovider类加密解密方法。

I would like to store encrypted string generated by RSA algorithm in database. As far as i know due to random padding rsa will generate different encrypted string every time for same plain text. Is there any way to store and compare these values in c# and sql?

What I have tried:

I am using default rsacryptoserviceprovider class encrypt decrypt methods.

推荐答案

解密它。除非你知道哪些位是随机填充,否则你无法比较它们 - 你不能比较它们!
Decrypt it. Unless you know which bits are the random padding, you can't compare them - and you don't!


这篇关于如何存储和比较使用非对称算法生成的加密字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆