Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Done
-
None
-
None
-
None
-
Yes
Description
While working on encryption UDFs a mismatch is found while generating public key from openssl genrsa from the terminal and create_asymmetric_pub_key().
Please find the steps to repeat the problem
1/* Generated private key */ openssl genrsa -out rsa.private 1024 2/*Generated public key*/ openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM 3/* Created a table to store the generated keys */ create table key_holder(priv varchar(2000), pub varchar(2000)); 4/* Inserted the keys */ insert into key_holder values (LOAD_FILE('/home/mohit.joshi/PS-7044/bld_01apr_2022/install/rsa.private'), LOAD_FILE('/home/mohit.joshi/PS-7044/bld_01apr_2022/install/rsa.public')); 5/* Saving the private key in a session variable */ SELECT priv from key_holder into @priv; 6/* Saving the public key in a session variable */ SELECT pub from key_holder into @pub 7/* Generate public key from UDF */ select create_asymmetric_pub_key('RSA',@priv); When the key generated in step 6 is matched with key generated in Step 7, a mismatch is found. This needs to be fixed.
When same steps are followed to generate external DSA private/public key pair, no mismatch is found.
1/* Generate DSA private key */ openssl dsaparam -out dsaparam.pem 1024 openssl gendsa -out dsaprivkey.pem dsaparam.pem 2/* Generate DSA public key */ openssl dsa -in dsaprivkey.pem -outform PEM -pubout -out dsapubkey.pem 3/* Create a table to load the content from the generated key files */ CREATE TABLE key_holder(priv varchar(2000), pub varchar(2000)); INSERT INTO key_holder VALUES (LOAD_FILE('/home/mohit.joshi/PS-7044/bld_01apr_2022/install/dsaprivkey.pem'), LOAD_FILE('/home/mohit.joshi/PS-7044/bld_01apr_2022/install/dsapubkey.pem')); 4/* Store the values of generated private/public keys in local variables */ SELECT priv from key_holder into @priv; SELECT pub from key_holder into @pub; 5/* Generate public key from UDF using external Private key */ SELECT create_asymmetric_pub_key('DSA',@priv); DSA public key generated from Step 5 exactly matches key stored in Step 4
Attachments
Issue Links
- relates to
-
PS-7044 Provide Enterprise Encryption UDFs for OpenSSL
-
- Done
-