Using a custom SSLSocketFactory for imqbrokerd on startup for SSLJMS

I want to startup imqbrokerd with my OWN custom SSLSocketFactory (to enable decrypting a password to send over as plaintext, so as to NOT store the password in plaintext on the filesystem).
I have tried to use this without success:
imqbrokerd -vmargs -Dssl.ServerSocketFactory.provider=MySSLServerSocketFactory -vmargs -Dssl.SocketFactory.provider=MySSLSocketFactory
I want to send an encrypted JMS message (i.e. SSL / TLS) from a client to a server (JMS topic/Queue) by using a trust/key store file without storing a plaintext password anywhere on the filesystem. I'm using the glassfish OpenMQ (i.e. imq) ver. 4.3.
I have a keystore and truststore combination with passwords for each of the stores. I was able to start up the IMQ Server, and create a simple Java MQ Client that will send JMS messages to the topic/queue with no problem. It seems to work just fine using JMS & SSL-JMS. My dilema is this: I want to be able to start up an SSL connection on the server using the truststore/keystore WITHOUT passing in the password as plain text (i.e. using a simple custom encryption algorithm).
I was able to work around this on the JMS Client by writing my own custom SSLSocketFactory (which decrypts the password stored on disk and sends it on, in memory, unencrypted to allow a client to connect to the server).
I did this by modifying:
*{jre_home}/lib/security/java.security*
file and putting in this line:
ssl.SocketFactory.provider=MySSLSocketFactory
My last problem to solve is how to get the IMQ Server to start up using an encrypted password (stored in a passfile properties file) and then unencrypt it, which will then allow me to open up the keystore and trustore to establish an SSL/TLS connection.
I found that there is a java.security file that will let you put in your own SSLSocket (this was how I got the client to work).
Example:
ssl.SocketFactory.provider=mypackage.MySSLSocketFactory
ssl.ServerSocketFactory.provider=mypackage.MySSLServerSocketFactory
However, these socket factories don't seem to get called when starting up the imq server (i.e. imqbrokerd.exe) for some reason?
I think it is because it is using the default SunJSSE security provider which seems to block the loading of my custom factory Classes?
Does anyone know how to solve this problem? Can I write a custom SSL SocketFactory, or do I have to write a custom Java Security provider or something like that?
Thanks for any ideas you may have.

I found the solution:
The source code for IMQ and J2EE is available to download.
You can then customize the code to do whatever you want (i.e. read in a
password in some encrypted format using an algorithm of your choice and
then unencrypting it before passing it on).
You can easily do this for the KEYSTORE / TRUSTSTORE password files by writing your own Java security provider.
Here are the steps for that:
*1. Write a custom java security provider.*
public class YOUR_PROVIDER_Provider extends java.security.Provider
your code here ...
public class YOUR_PROVIDER_Provider extends Provider
public YOUR_PROVIDER_Provider()
super("YOUR_PROVIDER_Provider", 1.0, "A Custom Security provider");
String className = YOUR_PROVIDER_Provider.class.getName();
put("KeyStore.JKS", className);
2. then,
Need an entry in the java.security file like this:
security.provider.1=YOUR_PROVIDER_Provider
The above order MUST be 1 in order to override the Sun default security provider
*@see java.security java.security file located in: {$JRE_HOME}\lib\security\*
**3. write your own JavaKeyStore* (you can download Sun's java source code to use as a baseline.
I would recommend using this one:
sun.security.provider.JavaKeyStore
If you change the package name to a custom one, you will need this (due to "package protect" accessor of this class)
sun.security.provider.KeyProtector
In this class:
sun.security.provider.JavaKeyStore
Modify these methods:
public Key engineGetKey(String alias, char[] password)
throws NoSuchAlgorithmException, UnrecoverableKeyException{
// ... your code
public void engineSetKeyEntry(String alias, Key key, char[] password,
Certificate[] chain)
throws KeyStoreException{
// ... your code
public void engineStore(OutputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
// ... your code
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
// ... your code
4. put your custom files inside a .jar file and put this in the java classpath AHEAD of the standard java ones:
e.g.
java -Xbootclasspath/p:YOUR_JAR.jar
you will have to do this inside the IMQ startup script
alternatively you can simply edit the imqbrokerd.conf file to something like this:
ARGS=-vmargs -Xbootclasspath/p:YOUR_JAR.jar:
this file is in: IMQ_HOME/etc/mq/

Similar Messages

  • Still searching for an answer for very slow startup, for firefox only (other browsers open quickly) on a Windows 7 PC -

    Firefox has a lag of over a minute from when I click the firefox button on my toolbar, and the time FF actually comes up. I've tried disabling add-ons, and even reverting to an older version of FF - still, same problem. Any suggestions?

    i have problem too
    i know im use many addons but they must be not the problem on the future because that addons is high Necessary plz fix that on next version of firefox
    thanks,

  • How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8

    Dear Sir/Madam,
    How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8.
    Actually my problem is that When i am using Custom  MessageBox in SelectionChangedEvent of LongListSelector,when i am click Open(Left Button) it's working fine and navigated correctly,But when i am Click the No(Right Button) then it stayed in same page
    but all that page is in stuckup i mean that page is not working and not doing any event.
    My C#.net Code
    private async void userPageLongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
    if (e.AddedItems.Count > 0)
    if (userPageLongListSelector.SelectedItem == null)
    return;
    if (dbTenMin == null)
    dbTenMin = new Database(ApplicationData.Current.LocalFolder, "tenMInDBSchema.db");
    await dbTenMin.OpenAsync();
    var res = (sender as LongListSelector).SelectedItem as _10Min._10MinClass.minUserPages;
    var resIndex = (sender as LongListSelector).ItemsSource.IndexOf(userPageLongListSelector.SelectedItem);
    string selectedPageName = res.userPages.ToString();
    string selectedPageDesignUser = res.pageDesignUser.ToString();
    int selectedIndex = resIndex;
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    string uidAndpwd = _10MinClass._10MinStaticClass.csUidAndPwd.ToString();
    _10MinClass._10MinStaticClass.csDataListPageDetails = selectedPageDataDetailsForSchema.ToString();
    _10MinClass._10MinStaticClass.csAllDataLists = offlineDataBaseDataListNam;
    _10MinClass._10MinStaticClass.csNotCreatedSchemaNameOfDBList = notCreatedDataLists;
    userPageLongListSelector.SelectedItem = null;
    if (dbTenMin != null)
    dbTenMin.Dispose();
    dbTenMin = null;
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    else
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    Same custom messagebox code working in Phone_BackKeyPress event i am writing the code in Right Button that e.OriginalSource.ToString(); then it is working fine.
    But It is not working in Selection Changed Event in LongListSelector control in Windows Phone 8.
    Please help me,as soon as possible.
    Thanks & Regards,
    SrinivaaS.

    What happens if you leave the implementation for LeftButton empty as well , does the page gets stuck in that case also, if you press left button?
    i.e.
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • Using Time Machine for an external startup drive

    I've never used Time Machine; I just kept on using my older backup startup drive software when starting with Leopard three years ago.
    My husband is getting a new iMac with an external drive for backup because I convinced him that Time Machine is so easy to use. Yes, I have a lot of faith that Apple knows what it is doing.
    However, I don't know how Time Machine works for making an external drive bootable. If it's not super easy for that purpose, I'm thinking that it might be easier to partition his external in setting things up for him, and putting SuperDuper! on one of the partitions.
    What do you think? Would Time Machine all by itself be super easy if he needed to startup from the external drive? Do you have to do anything other than to hold down the option key during startup to boot from an external drive backed up by Time Machine?
    He's getting an iMac with a 1T drive and an external Iomega 2TB eGo Desktop Hard Drive.
    I'm assuming that his new iMac will be coming with Snow Leopard, but it hasn't arrived yet and I don't know for sure about that. But I think if it doesn't come with Snow Leopard, I'd upgrade it for him before installing anything else.
    Thanks for any help!
    Mary

    Thanks so much to you for taking the trouble to help me learn something about Time Machine. I think I've learned enough now to get it set up for my husband without doing anything particularly stupid.
    Dave, there's no chance my husband would swing for a second external drive. I had to talk him into having one at all. He's not into managing a computer and doesn't want to think about stuff like backups. Once in awhile I'm in synch with that kind of orientation too, but then I recall the times I've been overjoyed to have good backups for myself... and my backup software is extremely reliable and easy to use.
    Pondidni and Thomas, thanks so much for all the links. I've spent enough time reading them that I think I've made up my mind to go with a SuperDuper! partition for the expected way to boot from the external drive. It's also a great reassurance that it would be possible to use a Time Machine backup partition for restoration via an install CD if SuperDuper! should fail, though. SuperDuper! did fail for me once, but fortunately I had another partition with a SuperDuper! backup.
    If the single backup drive fails, of course, that would be a nasty inconvenience. On the other hand, at this point I doubt that the actual losses in that unlikely event would impact my husband so horribly as it might for many who have work or school-related necessities stored on their computer. This is mainly a fun computer that he has at home, and if there ever are particularly important documents that he can't afford to lose, extra backups of those files could go onto a CD, DVD, or keychain drive. The chances of needing that are pretty slim.
    I know that eventually the backup drive will fail if it's used over a long enough period of time, but he seems ready to follow my advice to only even connect and turn on the external drive once a week and leave it connected only during the time it's actually actively making backups. (Unless some very important work is going on, in which case he knows to keep it connected during that period of time.) An external drive will likely last a good while longer than average under that kind of very limited use.
    Thomas, I do also believe in having extra backup external drives and hope to get one for my own computer in the near future. I noticed in shopping for my husband how much less expensively you can get a large external drive now than just a few years back.
    Thanks again so much to all for helping me to think through how I can help him get started with his own backups.
    Best wishes,
    Mary

  • How do I do use the custom code and format for a percentage with 2 decimals in Report Builder 3.0?

    In Report Builder 3.0, I have the following custom code entered:
      Public Function SafeDivide(Numerator as String, Denominator as String) as String
    Try
    If Numerator = “” or Denominator = “” then
    Return “-“
    End if
    If Numerator = “-“ or Denominator = “-“ then
    Return “-“
    End If
    If CDbl(Numerator) =0 or CDbl(Denominator) = 0 then
    Return “-“
    End if
    If IsNothing(Numerator) or IsNothing(Denominator) then
    Return "-"
    End if
    Return Val( ( (CDbl(Numerator) / CDbl(Denominator) )*100 ) )
    Catch
    Return "-"
    End Try
    End Function
    I call the custom code in the cell with the following equation:
      =Code.SafeDivide(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value),sum(Fields!LY_UNITS.Value))
    I have the format for the cell set to 0.00%, but it’s not being followed.
    I want the result to be formatted as a Percentage, but instead I get values like: 
    -78.9473684210
    80
    300
    -100
    I have the format for the cell set to 0.00%, but it’s not being followed.
    How do I do use the custom code and format for a percentage with 2 decimals?

    Hi AngP,
    After testing the issue in my local environment, I can reproduce it. Based on my research, I find this issue is caused by the type of Units_VAR_Percentage cell is string, while the type of CDbl(Parameters!Var_Threshold.Value) is double, so they cannot be
    compared.
    To fix this issue, we can add a hidden column (Textbox91) next to the Units_VAR_Percentage column, and type =(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value)) /sum(Fields!LY_UNITS.Value) as the expression. Then use the expression below to control the
    BackgroundColor:
    =iif(iif(reportitems!Units_VAR_Percentage.Value=CStr(format(reportitems!Textbox91.Value,"0.00%")),reportitems!Textbox91.Value,0)>CDbl(Parameters!Var_Threshold.Value),"Yellow","PaleTurquoise")
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Using a custom video player (skin) for Event Videos?

    Hi
    I'd like use something other than the 9 standard video skins that come with Captivate 6 (Halo, Clear and Corona). Is it possible to use a custom video player or at least a different skin for an Event video?  And, if so, does anyone know where I could find a collection of custom skins (free or otherwise)?
    Thanks
    Paul

    Well sure enough, that WPF MediaKit indeed uses D3DImage for the WPF interop. In fact he does things very similar to me except mostly he seems to use DirectShow whereas I'm 100% Media Foundation. Maybe should rethink that... If only DirectShow had H264
    support in Windows 8. Stupid licensing issues. Anyway thanks again for that link.

  • HT201303 Dear Customer Service: It is very frustrating for me. My Visa account keeps getting declined at Apple. I used this very same Visa card on Amazon with no problem. I checked my status for  the card and it is still all good. My friends an

    Dear Customer Service:
    It is very frustrating for me. My Visa account keeps getting declined at Apple. I used this very same Visa card on Amazon with no problem. I checked my status for
    the card and it is still all good. My friends and I buy a lots of Apple applications on iTune.
    We have the correct CVV2, Expiration Date and Billing address, but you keeps declining us. Please fix this problem for me. The issuing bank for this card is Techcombank, one of the largest banks in Vietnam. According to the bank, the transaction is processed in the US. This is a legitimate Visa card.
    Please let me know as soon as possible. Apple does a disservice to its brand name by declining legitimate Visa account holders from using the cards in Vietnam.
    Sincerely,
    <Edited by Host>

    Just as a warning, your credit card number has been sent in the clear to probably thousands of people, including anyone who subscribes to e-mail alerts to this forum.  That's very, very bad.  The credit card should be considered compromised at this point, and you should cancel it immediately, if you haven't done so already.

  • Can I use my custom board with LPC2378 processor with ULINK2 on Embedded module for ARM and LV.

    Issues in ARM and LV
    Can I use my custom board with LPC2378 processor with ULINK2 on Embedded module for ARM and LV.How can I create my elemental I/O vis or I have to use the existing Keil board vis. Confused. Please help.
    I have LV8.6. Which ver of embedded module for ARM should I buy. Website shows combined price for ARM module and LV. But I already have LV8.6 so what is the cost of module.
    Regards
    Shradha

              If the processor of your development board  is the cortex-M3 core, I think you do not have to buy keil board. Now, there are a lot of OS and emulator suitable for Cortex-M3.
              Operating system I am referring to  is the real time operating system such as keil RTX,uCOS,FreeRTOS,CooCox CoOS and so on. CooCox CoOS is very new, you can get more information from http://coocox.org/ .
              Emulator or debugging tools such as ULINK2,st-link,Jlink,CooCox Colink and so on. CooCox Colink is also very new.  You can download the Colink Plugin from here Colink Plugin . 

  • Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc

    Hi,
    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?
    12.1.4 / 11g db
    Appreciate your inputs.
    Thanks,
    K

    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc. It should work.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, What is the issue you have with R12?
    an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?What was Oracle feedback? Did they say it is certified and can be used?
    Thanks,
    Hussein

  • Errors encountered while using a Custom Security Realm on a Platform Domain

    Hi,
    We have created a WebLogic Platform Domain. A WebLogic Portal application(Portal
    7.0) and some Web Service apps are running on this domain.
    We have created a Custom Security Realm b'cos of our application requirements
    and now when I startup the Platform Domain, I see lot of errors.
    Some of the errors typically are
    "<Jan 16, 2003 4:07:02 PM EST> <Error> <HTTP> <101256> <The run-as user: wlisystem,
    for the servlet: ApplicationView for the webapp: /WLI_AI_Workshop_Control_Web,
    could not be resolved to a valid user in the system. Please check if the user
    exists.
    javax.security.auth.login.LoginException: Authentication Failed: User wlisystem
    denied in Realm Adapter realm weblogic"
    or
    Unable to deploy EJB: wlai-eventprocessor-ejb.jar from wlai-eventprocessor-ejb.jar:weblogic.ejb20.WLDeploymentException:
    weblogic.ejb20.interfaces.PrincipalNotFoundException: Authentication Failed: User
    wlisystem denied in Realm Adapter realm weblogic
    Do we have to create any predefined user accounts in the Security Store to get
    rid of these errors. I would appreciate if anyone can suggest some tips or workarounds
    for configuring or creating a Custom Security Realm for Web Logic Platform Domain.
    Thanks
    Vikram

    Hello Vikram,
    Are you using the new WLS 7.0 security framework? It is not supported for
    Portal 7.0. For Portal 7.0 apps you have to use compatibility mode (6.x
    style) security.
    Ture Hoefner
    BEA Systems, Inc.
    www.bea.com
    "Vikram Datla" <[email protected]> wrote in message
    news:3e273015$[email protected]..
    >
    Hi,
    We have created a WebLogic Platform Domain. A WebLogic Portalapplication(Portal
    7.0) and some Web Service apps are running on this domain.
    We have created a Custom Security Realm b'cos of our applicationrequirements
    and now when I startup the Platform Domain, I see lot of errors.
    Some of the errors typically are
    "<Jan 16, 2003 4:07:02 PM EST> <Error> <HTTP> <101256> <The run-as user:wlisystem,
    for the servlet: ApplicationView for the webapp:/WLI_AI_Workshop_Control_Web,
    could not be resolved to a valid user in the system. Please check if theuser
    exists.
    javax.security.auth.login.LoginException: Authentication Failed: Userwlisystem
    denied in Realm Adapter realm weblogic"
    or
    Unable to deploy EJB: wlai-eventprocessor-ejb.jar fromwlai-eventprocessor-ejb.jar:weblogic.ejb20.WLDeploymentException:
    weblogic.ejb20.interfaces.PrincipalNotFoundException: AuthenticationFailed: User
    wlisystem denied in Realm Adapter realm weblogic
    Do we have to create any predefined user accounts in the Security Store toget
    rid of these errors. I would appreciate if anyone can suggest some tips orworkarounds
    for configuring or creating a Custom Security Realm for Web Logic PlatformDomain.
    >
    Thanks
    Vikram

  • How do I use a custom UserInfo with a T3Client?

    This is related to my previous post, 4655. The problem is I if
    use a custom implementation of the interface
    weblogic.security.acl.UserInfo in a T3Client constructor, the
    client fails to connect. If I use
    weblogic.security.acl.DefaultUserInfoImpl, the client connects
    and disconnects without any problems. How do I use a custom
    UserInfo implementation with a T3Client?

    In don't know about the Gmail part, but for the Hotmail, try this link.
    Here's another link from a different source.

  • How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.

    How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.
    the computer:Mac Pro, Mac OS X (10.9.5), 2 x 2.66 Ghz 6-Core intel Xeon
    the TV: LG Smart tv

    The Mac uses a highly-parameterized universal Driver for every display. The parameters are set at certain times when a query is sent to your display. The display MUST answer with its name and capabilities, or the screen stays dark. A TV set that is off or "not paying attention" because it is set to a different port when the query occurs will rarely answer, and so will often remain dark.
    You can use tools in the System Report to see whether your display has been detected at all. If it has, the report will look something like this, but its name will appear:
    The times when the query is sent are:
    • at Startup
    • at wake from sleep
    • when the Mac-end of the cable is inserted
    • when using the Option ( Detect Displays ) button in displays preferences

  • Table and Field for Open Order Quantity for a Customer and Material

    Hi
    I created two sales orders 3 and 5 quantities, and delivered 1 qty in the second order.
    when I checked the table VBBE or VA05, I am able to see 3 and 4 qantities open.
    but I want to see the total 7 as open order qty, i.e, 3+4=7
    because both the orders are placed by the same customer and same material
    can u please tell me in which table exactly the total open order quantity for a customer and total open order quantity for a material is stored
    Madhu
    Edited by: madhubabu rao on Jul 1, 2008 1:49 PM

    HI,
    U can get the information in VA05 as there are columns like confirmed quantity and order quantty and status. U can use  summation button (add upto values) to get required information.
    Thx,
    Pramod

  • Error message: The preset used by one or more sequences in this project requires third-party components that could not be located. These sequences will be modified to use a custom sequence setting instead. To continue editing using the original preset, qu

    Hello all,
    I can't open a PP project without this error message appearing:
    "The preset used by one or more sequences in this project requires third-party components that could not be located. These sequences will be modified to use a custom sequence setting instead. To continue editing using the original preset, quit the application without saving the project, reinstall any third-party components that are required and reopen the project".
    What I had been doing before this occurred was editing a PP project using ProRes sequences and multi-camera editing. Multi-camera was not working very well and after a few attempts to fix that I gave up and finished the job cutting 3 layers of video instead. AME refused to render the three finished sequences of over 1hr duration so rendered final videos from the PP sequences.
    I tried deleting plists for AME, PP and QT, repairing disc permissions and rebooting but there was no improvement.
    Client is satisfied for now but will want to come back to this job at a later date so decided to uninstall and re-install AME and PP in the hope both would be ready to work properly when needed again. AME works fine in conjunction with a different PP project but now I can't open the PP project in question without the above error message appearing.
    Having searched the net it would seem that the problem may be caused by ProRes but I haven't been able to find a definitive solution for the problem. Does anyone know either:
    1. How to fix this?
    2. If I chose the "modified using a custom sequence setting", can I be sure that my sequences will look the same even if they don't use ProRes? The final deliverable format will be mp4 so as long as the overall look doesn't change then I can  afford a change in the edit codec. It's just that with three sequences over an hour long, I don't want days of work to be ruined.
    Other older PP projects of mine open and work fine.
    Premiere Pro CC 8.2.0
    Media Encoder CC 8.2.0.54
    OSX 10.10.2
    Any help would be greatly appreciated.
    Duncan.

    Adobe web chat come up with a solution.
    Open the PP project.
    Export your sequence or project as a Final Cut Pro XML file.
    Set up a new PP project.
    Import the Final Cut Pro XML file.
    This will get you back up an running.
    Since getting back to editing this project I have found that some things will be lost or change in using XML:
    You will lose position key framing, black video clips, dissolve fx, audio levels, audio dynamic fx, the ability to open a multi camera clip and change the camera view.
    You will keep cut points, crop fx.
    Not perfect but only took a couple of hours to save 3 days work.

  • How to use a custom KeyManager in nonblocking SSLSocketChannel

    In our existing project I had to replace the nonblocking SocketChannel by nonblocking SSLSocketChannel. My implementation of the nonblocking SSLSocketChannel hides all the SSL stuff and can be used like a SocketChannel in the whole project you just have to use the SSLSocketChannelProvider instead of SocketChannelProvider in one place.
    Now I have a new requirement . Different server-certificate should be used for different IP-Addresses on the same SSLServerSocket. The relationship between IPs and certificates is well-know. The first idea was to use a custom KeyManagerDelegate which extends X509ExtendedKeyManager to choose the server certificate. The KeyManagerDelegate should delegate the calls to a KeyManager obtained by
    KeyManagerFactory.getInstance("NewSunX509").getKeyManagers();This works if I use a blocking SSLServerSocket obtained by SSLContext.getServerSocketFactory().createServerSocket();
    But the KeyManagerDelegate is never called by the SSLContext if I use my own nonblocking SSLServerSocketChannel. Instead of calling my KeyManagerDelegate the SSLEngineImpl throws an Exception
    javax.net.ssl.SSLHandshakeException: no cipher suites in common
         at com.sun.net.ssl.internal.ssl.Handshaker.checkThrown(Handshaker.java:951)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:466)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1092)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1064)
         at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:452) The next thing I’m going to try would be to get the SSLContext to use my own SSLSocketChannelProvider as ServerSocketFactory.
    Or I use different SSLContext for each incoming connection, which would break my clean design as the server had to mess around with building new SSLContext. Another possibility is to implement a callback in the ServerSocketChannel to get a new SSLContext for each accepted connection. This would safe my design but looks like an ugly workaround to me and I'm not sure yet if it works.
    Any better ideas?
    Thanks Domi

    Thank you for your response.
    At the moment I try this in my unit-test (this is the working blocking code)
    final KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
    final KeyStore ks = KeyStore.getInstance("JKS");
    ks.load(new FileInputStream(System.getProperty("javax.net.ssl.keyStore")), password);
    kmf.init(ks, password);
    final KeyManager[] km = kmf.getKeyManagers();
    final SecureRandom random = new SecureRandom();
    context.init(new KeyManager[]                                                                   //TrustManager not shown here
             {new KeyManagerDelegate((X509KeyManager) km[0])}, tmf.getTrustManagers(), random);
    final ServerSocket serverSocket = context.getServerSocketFactory().createServerSocket();
    serverSocket.accept();The KeyManagerDelegate just delegates all calls to the underlying KeyManager (shown at the end)
    or (not working)
    final KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
    final KeyStore ks = KeyStore.getInstance("JKS");
    ks.load(new FileInputStream(System.getProperty("javax.net.ssl.keyStore")), password);
    kmf.init(ks, password);
    final KeyManager[] km = kmf.getKeyManagers();
    final SecureRandom random = new SecureRandom();
    context.init(new KeyManager[]                                                      //TrustManager not shown here
             {new KeyManagerDelegate((X509KeyManager) km[0])}, tmf.getTrustManagers(), random);
    provider = SSLSelectorProvider.provider(context);                             //My SSLProvider
    final ServerSocketChannel ssc = provider.openServerSocketChannel();  // My SSLServerSocketChannel
    final SSLSelector sel = provider.openSelector();
    ssc.register(sel, SelectionKey.OP_ACCEPT, new AcceptHandler());the SSLEngine is created by the SSLSocketChannel resulting from the accept in the SSLServerSocketChannel. It uses the same SSLContext as the provider, but here the KeyManagerDelegate is never called.
    Or what do you mean by associated, did I miss your point?
       private static class KeyManagerDelegate
          extends X509ExtendedKeyManager
          private final X509KeyManager _manager;
          KeyManagerDelegate (final X509KeyManager manager)
             _manager = manager;
          @Override
          public String chooseClientAlias (final String[] arg0, final Principal[] arg1, final Socket arg2)
             return _manager.chooseClientAlias(arg0, arg1, arg2);
          @Override
          public String chooseServerAlias (final String arg0, final Principal[] arg1, final Socket arg2)
             return _manager.chooseServerAlias(arg0, arg1, arg2);
          @Override
          public X509Certificate[] getCertificateChain (final String arg0)
             return _manager.getCertificateChain(arg0);
          @Override
          public String[] getClientAliases (final String arg0, final Principal[] arg1)
             return _manager.getClientAliases(arg0, arg1);
          @Override
          public PrivateKey getPrivateKey (final String arg0)
             return _manager.getPrivateKey(arg0);
          @Override
          public String[] getServerAliases (final String arg0, final Principal[] arg1)
             return _manager.getServerAliases(arg0, arg1);
       }

Maybe you are looking for

  • QAS Refresh from PRD

    Dear Bhudev/Guest, I am Planning to refresh my Quality system from Production's Offline Database Backup. I have seen you a lot posts. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Refresh from Offline backup (

  • Address Book on Windows?

    I had no trouble with my Mac at home, I entered contacts into the iPod, synced and was able to access the program Address Books through the Applications folder on my iMac G4. The contacts were right there. Now I'm at work, using Windows 2007, and I'v

  • Itunes for XP 64 bit machines ?????

    I have an XP 64 bit machine. I just bought an Ipod touch. I want to get Itunes of course but it seesm they onyl support 32 bit machines and 64 bit machines on Vista. I have tried both of these but they will not load. How can I get itunes for 64 bit X

  • Transport an Action Profile is not working

    Hi Gurus We have configures Service Desk and we copied an existing action file to ZLFN_Action Profile. When i am trying to tranport when i look for Action profile entries ia m  not able to see my customized action profile Please help me Thanks Bhaska

  • How to create a Lync policy to force the AD picture to be used.

    Hi there We are using office 365 and ADFS, how we can create a Lync policy to force the AD picture to be used. Best regards,