Encrypting with SQL in test database, can't drop Master Key because it encrypted a 'test' certificate

So I'm not sure I understand how severe this problem is, but I'm messing around in a test database for practice for encyption. I was planning on implementing TDE on the data, but I tried making a Master Key on the SQL 2012 manager interface and made certificates earlier, and thought I could just Drop the Master Key... but I couldn't. It said that it had a 'testcertificate' that was encrypted by the master key, something I made during the practice session.

I do not have the password for the master key nor the certificate. Does that mean that I am completely screwed? The column and testcertificate are meaningless. Everything else runs fine, but I can't make a new Master Key... which should be done because this time I copy-pasted the password.

2 Answers

If you encrypted by password, you can simply generate a new master key with a new password as follows:

USE master
GO
ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'Password1234';
GO

Any certificates using the old master key will automatically inherit the new master key since there can be only one.

2

Since you don't care about retaining any of the certificates, you can just drop them; the password isn't required. Based on what you have above, I'd try the following:

drop certificate [testcertificate];
drop master key;

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like