[sip-comm-dev] Password Storage: Week 1


#1

Hi all,

Like I already wrote to my mentors, here's an overview of what I've
been doing concerning password storage:

I made AES encryption/decryption, it works with Java 6 without any dependencies.
Then I looked where to put the code that asks for the master password
(on SC startup or login), and it seems to me that
LoginManager.runLogin is the place to do it. After this method the
protocol specific threads start, and eventually ask
ProtocolProviderFactory for a password. ProtocolProviderFactory loads
the passwords from the configuration, or if it's not there the user is
prompted for a password. What I wanted to do is to create a
credentials service that loads + decrypts / saves + encrypts
passwords. This service has a reference to the config service and a
crypto class. So, inside LoginManager.runLogin before the threads
start, the service checks somehow if the master password needs to be
asked at all and the user is prompted if so. The master password is
then handed to the crypto class to make a symmetric key out of it.
After that it's just a matter of changing a couple of methods in the
ProtocolProviderFactory to use my service.
However, at the moment I cannot get my service to work. The jar seems
to be created ok, but when I ask bundleContext for my service I get
ClassNotFoundException. I used other services as an example and I'm
not sure what can be wrong. Can anyone suggest what the problem could
be?
Perhaps there is another way to do this. What I want to achieve is to
get the master password from the user into some class that can be
accessible for protocols for later use.

I'm also in need of a svn branch. I'll send my java.net name to Emil.

Have good weekend,
Dmitri

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Please provide the stack trace of the exception. Or at least some
diagnostic message that you're seeing.

···

On Sat, May 15, 2010 at 9:00 PM, Dmitri Melnikov <dmitri807@gmail.com> wrote:

However, at the moment I cannot get my service to work. The jar seems
to be created ok, but when I ask bundleContext for my service I get
ClassNotFoundException. I used other services as an example and I'm
not sure what can be wrong. Can anyone suggest what the problem could
be?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Here's what I get:

19:45:46.613 SEVERE: util.UtilActivator.uncaughtException().76 An
uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main]
and message was:
net/java/sip/communicator/service/credentialsstorage/CredentialsStorageService
java.lang.NoClassDefFoundError:
net/java/sip/communicator/service/credentialsstorage/CredentialsStorageService
  at net.java.sip.communicator.impl.gui.GuiActivator.getCredentialsStorageService(GuiActivator.java:264)
  at net.java.sip.communicator.impl.gui.main.login.LoginManager.runLogin(LoginManager.java:89)
  at net.java.sip.communicator.impl.gui.UIServiceImpl$RunLoginGui.run(UIServiceImpl.java:747)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException:
net.java.sip.communicator.service.credentialsstorage.CredentialsStorageService
  at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:814)
  at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
  at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1733)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  ... 11 more

The GuiActivator.getCredentialsStorageService method is analogous to
other get methods in that class (like getConfigurationService for
example)

···

On Sat, May 15, 2010 at 9:03 PM, Lubomir Marinov <lubo@sip-communicator.org> wrote:

On Sat, May 15, 2010 at 9:00 PM, Dmitri Melnikov <dmitri807@gmail.com> wrote:

However, at the moment I cannot get my service to work. The jar seems
to be created ok, but when I ask bundleContext for my service I get
ClassNotFoundException. I used other services as an example and I'm
not sure what can be wrong. Can anyone suggest what the problem could
be?

Please provide the stack trace of the exception. Or at least some
diagnostic message that you're seeing.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Did you export the package
net.java.sip.communicator.service.credentialsstorage from the bundle
in which it is located and did you import it into the UI bundle?

···

On Sat, May 15, 2010 at 9:08 PM, Dmitri Melnikov <dmitri807@gmail.com> wrote:

19:45:46.613 SEVERE: util.UtilActivator.uncaughtException().76 An
uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main]
and message was:
net/java/sip/communicator/service/credentialsstorage/CredentialsStorageService
java.lang.NoClassDefFoundError:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#5

Export yes, import no, if that simply means adding corresponding lines
in the manifests.
After importing my service in swing.ui.manifest.mf I get:
java.lang.NullPointerException: Specified service reference cannot be null.
  at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:320)
  at net.java.sip.communicator.impl.gui.GuiActivator.getCredentialsStorageService(GuiActivator.java:267)
  at net.java.sip.communicator.impl.gui.main.login.LoginManager.runLogin(LoginManager.java:89)
  at net.java.sip.communicator.impl.gui.UIServiceImpl$RunLoginGui.run(UIServiceImpl.java:747)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

···

On Sat, May 15, 2010 at 9:11 PM, Lubomir Marinov <lubo@sip-communicator.org> wrote:

On Sat, May 15, 2010 at 9:08 PM, Dmitri Melnikov <dmitri807@gmail.com> wrote:

19:45:46.613 SEVERE: util.UtilActivator.uncaughtException().76 An
uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main]
and message was:
net/java/sip/communicator/service/credentialsstorage/CredentialsStorageService
java.lang.NoClassDefFoundError:

Did you export the package
net.java.sip.communicator.service.credentialsstorage from the bundle
in which it is located and did you import it into the UI bundle?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#6

Hey all,

We've just had a quick off-list chat with Dmitri so here's a short
summary for the record.

The NPE below is probably caused by the CredentialsStorageService (CSS)
being started after the GUI needs to use it.

The real issue, however, is that the GUI service doesn't really need to
know about the existence of the CSS. Protocols would be the only ones
using the CSS. The first time they do this would be during initial
registration. If no stored password is available at this time, the CSS
would return null and the protocol provider would reques credentials
from the authority that it received in its register method (i.e. the GUI).

If, however, a stored password exists, and if that password needs to be
decrypted, and if the CSS does not already have a master password stored
in memory, then it would popup a dumb JOptionPane-style dialog and
request one from the user.

Dmitri noted that this would have to be handled in a blocking manner,
making sure that multiple protocols asking for a password, would not
result in the user being asked for the master password more than once.

I believe that pretty much sums it up.

Cheers,
Emil

На 15.05.10 20:24, Dmitri Melnikov написа:

···

Export yes, import no, if that simply means adding corresponding lines
in the manifests.
After importing my service in swing.ui.manifest.mf I get:
java.lang.NullPointerException: Specified service reference cannot be null.
  at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:320)
  at net.java.sip.communicator.impl.gui.GuiActivator.getCredentialsStorageService(GuiActivator.java:267)
  at net.java.sip.communicator.impl.gui.main.login.LoginManager.runLogin(LoginManager.java:89)
  at net.java.sip.communicator.impl.gui.UIServiceImpl$RunLoginGui.run(UIServiceImpl.java:747)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

On Sat, May 15, 2010 at 9:11 PM, Lubomir Marinov > <lubo@sip-communicator.org> wrote:

On Sat, May 15, 2010 at 9:08 PM, Dmitri Melnikov <dmitri807@gmail.com> wrote:

19:45:46.613 SEVERE: util.UtilActivator.uncaughtException().76 An
uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main]
and message was:
net/java/sip/communicator/service/credentialsstorage/CredentialsStorageService
java.lang.NoClassDefFoundError:

Did you export the package
net.java.sip.communicator.service.credentialsstorage from the bundle
in which it is located and did you import it into the UI bundle?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--
Emil Ivov, Ph.D. 67000 Strasbourg,
Project Lead France
SIP Communicator
emcho@sip-communicator.org PHONE: +33.1.77.62.43.30
http://sip-communicator.org FAX: +33.1.77.62.47.31

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net