urgent plz- decrypting a value

  • i have a table with

    testtable

    var1 int pk,

    prize_id int

    prize_encrypt varbinary

    i am storing encrypted value of prizE_id in prize_encrypt

    by the following statement.

    DECLARE @pass VARCHAR(50)

    SET @pass = 'WOhPorN5VIKZl$Eqcz4CR104O'

    DECLARE @prize_encrypt VARBINARY(256)

    Set @prize_encrypt = EncryptByPassphrase(@pass,Cast(@prize_id as varbinary))

    values are

    12sdf2342sdgdh243gdfb3445

    21dfgkfgjh94334fghfdghi95

    32sdf2342sdgdh243gdfb3445 (repating as first record)

    in order to aviod repeation

    DECLARE @pass VARCHAR(50)

    DECLARE @prize_pass VARCHAR(50)

    SET @pass = 'WOhPorN5VIKZl$Eqcz4CR104O'

    DECLARE @prize_encrypt VARBINARY(256)

    SELECT @maxval=IDENT_CURRENT('testtable') +1

    set @prize_id_pass = @pass +','+CAST(@maxval AS VARCHAR)

    Set @prize_encrypt = EncryptByPassphrase(@prize_pass,Cast(@prize_id as varbinary))

    Encrypting is in one stroed proc..

    and decryption is in another stored proc..

    the above one is working with out repeating..

    but now if i try to decrypt the prize_encrypt i am getting null value.

    DECLARE @pass VARCHAR(50)

    DECLARE @prize_pass VARCHAR(50)

    SET @pass = 'WOhPorN5VIKZl$Eqcz4CR104O'

    DECLARE @prize_encrypt VARBINARY(256)

    SELECT CAST(DecryptByPassphrase(@prize_pass, prize_encrypt) AS varchar) as val2

    from testtable

    i am getting NULL value if i do like this..

    please help me on this..

  • don't crosspost. you only need to ask once, the Newest Posts feature lets us see everything. asking the same question multiple places wastes posters time and fractures the continuity of your questions.

    follow the original thread here

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply