Encrypted .dmg secure for saving passwords?

Hi folks!

Is it a good idea to save my passwords and personal information in text files stored in a .dmg file (encrypted)?

I know the encryption is strong enough, but are the text files also secure after I mount the .dmg and type in my password?

I know there are very elegant solutions like 1Password, but I'm just curious whether my current solution is secure.