USP_IMPORTENCRYPTIONKEY_GET

Returns the public and private key for the specified bit strength.

Parameters

Parameter Parameter Type Mode Description
@PUBLICKEY varbinary INOUT

Definition

Copy


            create procedure dbo.USP_IMPORTENCRYPTIONKEY_GET
            (
                @PUBLICKEY varbinary(32) output
            )
            as
                set nocount on

                exec dbo.USP_GET_KEY_ACCESS

                begin try
                    select top 1
                        @PUBLICKEY = convert(varbinary(32), DecryptByKey(PUBLICKEY))
                    from dbo.IMPORTENCRYPTIONKEY
                    order by DATEADDED -- There should only be 1 row but just in case give preference to 1st row created


                    close symmetric key sym_BBInfinity
                end try
                begin catch
                    close symmetric key sym_BBInfinity
                end catch