• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

有什么方法可以在Oracle/PL SQL使用RSA?

用户头像
it1352
帮助1

问题说明

我需要使用RSA(公钥/私钥)对pl/sql中的数据进行加密/解密,但找不到任何方法.已经检查过 dbms_crypto 程序包,但似乎没有支持RSA算法.

I need to encrypt/decrypt data in the pl/sql with RSA (public/private key) but could not found any way to do it. Already checked dbms_crypto package but it seems it doesn't support RSA algorithm.

有什么方法可以在PL SQL中使用RSA?还是建议您改用哪种非对称算法?

Is there any way to use RSA in the PL SQL? Or which asymmetric algorithm would you suggest to use instead?

问题说明

就我而言,我生成了随机密钥(每次迭代中只有几百万个密钥),需要将其加密存储在DB中.然后,在被请求时,我需要解密这些密钥并导出为文件.另外,不允许将重复的密钥存储在DB中.RSA对于这种情况似乎很完美,但是免费版本的Oracle加密软件包不支持RSA.需要建议来处理这些要求.

In my case, I generate random keys (few millions in each iteration) which needs to be stored encrypted in DB. Then, when requested I need to decrypt those keys and export as a file. Also, it is not allowed to store duplicate keys in DB. RSA seems perfect for this case but it is not supported in the free version of Oracle cryptography package. Need suggestion to handle those requirements.

正确答案

#1

我的开源Oracle PL/SQL程序 crypto4ora可以使用RSA公钥和私钥对消息进行加密和解密.

My open source Oracle PL/SQL program crypto4ora can encrypt and decrypt messages using RSA public and private keys.

有关安装的详细信息,请参见项目页面.这些步骤基本上是下载,运行 loadjava ,然后运行SQL脚本.

See the project page for installation details. The steps are basically download, run loadjava, and then run a SQL script.

下面是生成密钥,加密和解密的完整示例:

Below is a full example of generating keys, encrypting, and decrypting:

--Generate keys.  Store the private and public key for later.
SELECT CRYPTO.RSA_GENERATE_KEYS(KEY_SIZE => 1024)
  FROM DUAL;

--Encrypt and store encrypted text.
SELECT CRYPTO.RSA_ENCRYPT(PLAIN_TEXT => 'This is my secret message.',
                          PUBLIC_KEY => '<use public key from above>')
  FROM DUAL;

--Decrypt, using the encrypted text and the private key, and it returns the plain text.
SELECT CRYPTO.RSA_DECRYPT(ENCRYPTED_TEXT => '<use output from above>',
                          PRIVATE_KEY    => '<use private key from first step>')
  FROM DUAL;

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfkbba
系列文章
更多 icon
同类精品
更多 icon
继续加载