⬆️ ⬇️

Import KeePass Password Database into KWallet

Hello.



At the enterprise where I work, I love all sorts of things for “security” and unfortunately everything is Windows. But bad luck, I have Linux and sent me passwords to the database for KeePass (note: I don’t want to install the KeoPass mono application under Linux). Windows is a virtual machine, but keeping it open is not always a hunt, because it eats away memory anyway. It was then that I had the idea to transfer all the passwords from this database for KeePass to my KWallet.



By the way, for those who are not familiar with KWallet I will describe it a little. This is a program that is included in the standard KDE distribution and is intended for storing sensitive information used by KDE applications. Here I have stored passwords on various sites, access keys, etc. In other words, this is the same as KeePass, but under Linux. And there is one of the significant advantages that I don’t need to use my hands to save and paste passwords into the login and password fields, and the programs themselves take it out of my Wallet, the only thing they are asking is to enter the password to open the wallet if it is closed. Very convenient, especially since it integrates perfectly with applications. And I wouldn’t be surprised if Microsoft will soon, like everything else, copy it into Windows.



So let's continue. I decided to make the transfer of passwords as simple as possible, namely, to export passwords from KeePass to XML, apply the transformation to the XML format, the digestible KWallet, and then import it into my wallet. I thought and did, especially since I’m writing this article longer than writing the XSLT conversion.

')

By the way, here it is:

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <wallet name="kdewallet"> <xsl:for-each select="KeePassFile/Root//Group"> <folder name="{Name}"> <xsl:for-each select="Entry"> <map name="{String[Key/text() = 'Title']/Value}"> <mapentry name="{String[Key/text() = 'UserName']/Value}"><xsl:value-of select="String[Key/text() = 'Password']/Value"/></mapentry> </map> </xsl:for-each> </folder> </xsl:for-each> </wallet> </xsl:template> </xsl:stylesheet> 




And for conversion, I used xsltproc with this command:

 xsltproc -o kwallet.xml ./keepas2kwallet.xsl ./keepass.xml 




The resulting kwallet.xml file was successfully imported into my wallet. And now all the passwords from KeePass live perfectly in my KWallet wallet.



And the structure of the imported wallet is:
  1. KeePass group is a separate directory in KWallet
  2. KeePass post title is the name of the match.
  3. KeePass username and password are stored as is.






Note 1: I want to notice that I did this in order to use only native Linux applications, and not Windows programs ported to Linux.

Note 2: I am writing this article to share with the community the result of my work, suddenly someone will come in handy.



UPD: This article is not aimed at advertising KWallet, and I'm not trying to convince anyone - a matter of taste. I like KWallet, I use it and therefore I propose an import option. Who does not agree - your opinion and my opinion you do not change. Do not like do not use. And if you like that ...



Take advantage of the health

Source: https://habr.com/ru/post/190880/



All Articles