Unable to decrypt data bag in default.rb


I followed this link to create a secret key.
However, when I want to decrypt the databag using this code from this link, it throws a

[2016-04-22T11:35:36+08:00] FATAL: Chef::EncryptedDataBagItem::DecryptionFailure: Error decrypting data bag value: 'bad
decrypt'. Most likely the provided key is incorrect. false

Any idea how do I decrypt the keys? Thanks.

Don't forget about encrypted data bag versions. Currently, only version 2 is used and I specify in my knife.rb:

data_bag_encrypt_version 2