有什么方法可以在Oracle

有什么方法可以在Oracle

本文介绍了有什么方法可以在Oracle/PL SQL中使用RSA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用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.

推荐答案

我的开源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;

这篇关于有什么方法可以在Oracle/PL SQL中使用RSA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:54