javascriptcommand-line-interfacetizentizen-web-app

CLI Tizen build-web displays Invalid Password error


I'm trying to build a tizen web application for a Samsung Active 2 smartwatch from CLI (Arch linux) and I keep getting this error:

[ERROR] Main.java(195) - org.tizen.common.sign.exception.CertificationException: Invaild password

I've followed this manual: Tizen CLI manual

The command I use to build the package is:

tizen package -t wgt -s CertificateName  -- .

Where CertificateName is the name of my already existing certificate that I created using also the CLI with the command:

tizen certificate -a CertificateName -p password -n Name -e fake@email.com

After generating the certificate I've added to the security profiles using the command:

tizen security-profiles add -n author -a /home/user/tizen-studio-data/keystore/author/author.p12 -p password

And after it, I've added the Trust Anchor to the project with the command:

tizen trust-anchor set -c /home/user/tizen-studio-data/keystore/author/author.p12 -s true -- projectfolder

How can I fix the Invalid Password error? Thanks!


Solution

  • When you call tizen package, the app checks the certificates' entries of the default profile.xml file that you set. It should look like this:

    <profileitem ca="<tizen>/tools/certificate-generator/certificates/developer/tizen-developer-ca.cer" distributor="0" key="<tizen-data>/keystore/author/<cert>.p12" password="<tizen-data>/keystore/author/<cert>.pwd" rootca=""/>
    
    <profileitem ca="<tizen>/tools/certificate-generator/certificates/distributor/tizen-distributor-ca.cer" distributor="1" key="<tizen>/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.p12" password="<tizen-data>/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.pwd" rootca=""/>
    

    Actually, the passwords aren't stored in the *.pwd files but in the Login keyring of gnome-keyring. In order to retrieve the passwords previously stored by calling tizen security-profiles add, tizen package calls:

    <tizen>/tools/certificate-encryptor/secret-tool lookup --label=tizen-studio.

    You'll see by using the command above that you'll have an error giving more information than tizan package. In your case, gnome-keyring may not be installed or the Login keyring may not be correctly initialized.

    SOLUTION #1

    To resolve the issue the simplest thing to do is to install/reinstall the gnome-keyring package and reboot (or restart gnome-keyring-daemon):

    pacman -S gnome-keyring
    reboot
    

    This should add the Login keyring and if it doesn't you can add it manually using seahorse or echo <PASSWORD> | gnome-keyring-daemon --unlock

    Finally, re-add your profile with tizen security-profiles add. You can see the Tizen blog post for remote/docker configuration.

    SOLUTION #2

    If you don't want to bother with gnome-keyring you can try to add the passwords directly in the profiles.xml file as shown on the Tizen forum and written below:

    <profileitem ca="<tizen>/tools/certificate-generator/certificates/developer/tizen-developer-ca.cer" distributor="0" key="<tizen-data>/keystore/author/<cert>.p12" password="<strong_password>" rootca=""/>
    
    <profileitem ca="<tizen>/tools/certificate-generator/certificates/distributor/tizen-distributor-ca.cer" distributor="1" key="<tizen>/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.p12" password="tizenpkcs12passfordsigner" rootca=""/>