Let JNDI use a own TrustManager interface implementation

morning,
i did now reach the point where my ldap enabled application is able to connect to a directory server over ssl.
i further figured out, that it is possible to tell jsse to use a own implementation of the TrustManager interface so that i would, e.g. be able to let my application talk to every directory server without any matter of being the certificate used by that server added to the keystore file used by the application.
now one of the last problems is, that i do not know how to tell the jndi to use my customized X509TrustManager implementation.
can anyone tell me how i can do that, please?
greez
dialsc

Hello.
Frist you create your own Trust manager, which looks something like:
package test;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
public class TestX509TrustManager implements X509TrustManager {
    public TestX509TrustManager() {
    public void checkServerTrusted(X509Certificate[] chain, String authType) throws
            CertificateException {
    public X509Certificate[] getAcceptedIssuers() {
        return null;
    public void checkClientTrusted(X509Certificate[] chain, String authType) {
        return;
}Then you create your own Socket factory which looks something like:
package test;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;
import java.security.KeyManagementException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import java.security.NoSuchAlgorithmException;
public class TestSocketFactory extends SocketFactory {
    private static TestSocketFactory factory;
    private SSLSocketFactory sf=null;
    private TestSocketFactory() {
            createFactory();
    public static synchronized SocketFactory getDefault() {
        if(factory == null){
            factory = new TestSocketFactory();
        return factory;
    public void createFactory() {
        try {
            TrustManager[] tm = new TrustManager[] {new TestX509TrustManager()};
            SSLContext sc = SSLContext.getInstance("TLS");
            sc.init(null, tm, null);
            sf = sc.getSocketFactory();
        catch (KeyManagementException e) {}
        catch (NoSuchAlgorithmException e) {}
    public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
        return sf.createSocket(host,port);
    public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
            throws IOException, UnknownHostException {
        return sf.createSocket(host, port, localHost, localPort);
    public Socket createSocket(InetAddress host, int port) throws IOException {
        return sf.createSocket(host,port);
    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
            throws IOException {
        return sf.createSocket(address, port, localAddress, localPort);
}Finally, you'll have to tell the system to use your custom Socket factory:
    LdapContext ctx = null;
    public LdapTest() throws NamingException {
        Hashtable env = new Hashtable(11);
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://myserver.com:636/dc=foo");
        env.put(Context.SECURITY_PROTOCOL, "SSL");
        env.put(Context.SECURITY_AUTHENTICATION, "none");
        env.put("java.naming.ldap.factory.socket", "test.TestSocketFactory");
        ctx = new InitialLdapContext(env, null);
    }The important statement above is: env.put("java.naming.ldap.factory.socket", "test.TestSocketFactory");

Similar Messages

  • I have a TBI. Password security is hard for me. How do I find someonne to let me use my own passwords w/o writing them down or storing them on a computer??

    I have always used the same 3 passwords for everything. 3 are too many for me. I forget them and need to reset. Now, I can no longer use passwords I know and can remember. The new requirements for length, types of characters and stuff is really hard. I came up with a good one, but because it was new, I forgot. Then they say you can't reuse your passwords! Everytime I forget, I have to make-up something new to forget.
    I have a request for reasonable accomodation under the ADA.  I need an exception on my account that will let me use a recent password. I do not mind going through security questions.  I can remember the answers to those!  I am disabled.  I need this assistance for account accessibility.  I do not believe accomodating my problems from traumatic brain injury would be unreasonable.
    Apple can't pay for enough peoople to actually do customer assistance, I guess. They just think we all have the same issues, they've heard it all before, and you can hunt and find your answer.  This forum was all I saw that could lead to human interaction about this.
    I'd also love advice for other popular sites, if you have any.
    I put this under physical and motor skills because my brain has been physically damaged.  Notice they don't even have a category for mental and learning disabilities.
    Sorry for the "rant," but I have cried over my keyboard too many times now. Added to all the other stress of a TBI, now my ability to use the Internet is going down the toilet. It is my only interaction with the world beyond my walls and family.

    This is designed to be a user discussion area. To provide feedback directly to Apple you can go to http://www.apple.com/feedback/
    There are a few applications out now that may be able to help you out. 1Password and LastPass are both password vault or lockers. They allow you to save passwords for applications and websites. That way you have a single password you use to keep the vault/locker secure and then all of your other passwords are stored for you so you don't have to write them down or try to remember them all.
    https://agilebits.com/onepassword
    https://lastpass.com/index.php

  • Use of DynamicProxies vs Interface/Implementation

    hi all,
    recently i came across DynamicProxies...i liked them and i wanted to apply them to my application, but i have a doubt.
    In which cases it's worth using Dynamic Proxies instead of using an interface and different implementations?
    In our app we have different Business Delegates, no common interface between, them.. If we could have one, then there will be no need to explicitly instantiate them in some, let's say, Action classes (struts..), but we could have a common factory which caches all the business delegates.
    If we follow this approach of a common interface between business delegates, in which case it's better
    to use DynamicProxies instead of writing different implementations of the same interface?
    thanx in advance and regards
    Marco

    Its not clear to me exactly what you are trying to do.....
    Are you just saying that you want a 'generic' factory which creates / caches business delegates?
    If thats the case, Im not sure why you would need to use a dynamic proxy... This is because im assuming in your set up you would go to the factory each time you wanted a business delegate - so the caching is taken care of there for you.
    One motivation for using dynamic proxies in this set up would be if you wanted to build the caching on top of the business delegate itself.
    This would be useful in this sort of set up:
      public class SomeBusinessDelegateClient {
        private SomeBusinessDelegate delegate;
        public void setDelegate(SomeBusinessDelegate delegate) {
          this.delegate = delegate;
        public void execute() {
          delegate.doSomething();
      }Here, the business delegate you are using is being given to you. You just go ahead and use it whenever you need to.
    But what if the 'real' business delegate had to be cached by some means?
    Well, the factory which creates your delegates can wrap them in a dynamic proxy which validates its local cache before every invocation on the underlying delegate.
    This removes a small bit on complexity (i.e knowing about the factory) from your client code.
    In most cases, this is probably overkill, but it works well in some Inversion Of Control frameworks where the framework 'wires up' your collaborators at application start - and you just 'go use them' from then on without having to worry about factories / service locators etc etc

  • Mail.app won't let me use my own smtp server, but Thunderbird will. Why?

    In Mail, [email protected] will not send mail using smtp.mydomain.com (Mail cannot send using this server) I've always had to resort to using my ISPs (mail.adelphia.net)
    However I have the same account setup in Thunderbird (on the same computer) and I am able to send mail using smtp.mydomain.com. I'm using the same exactly settings (port 25, no SSL, authentication w/ username & password)
    Also what is odd is that in Mail I can use smtp.mac.com as an outgoing mail server for my .Mac account.
    PowerMac G5 2.5Ghz DP & Macbook Black   Mac OS X (10.4.8)  

    try: port 587, authentication, username as yr incoming mail u/name, password likewise. Also, SSL may help the authentication process, fooling the server into better authorisation. You may get a warning screen the first time, something like yr server may not be secure etc., just ignore it, say ok and if you get the whoosh sound, the mail's gone.
    Also, try a Keychain first aid repair.

  • When recording a video using quicktime and my built in camera (isight) how come the program wont let me use my audio interface rather than the built in mike?

    when recording a video using quicktime and my built in camera (isight) how come the program wont let me use my audio interface rather than the built in mike?

    when recording a video using quicktime and my built in camera (isight) how come the program wont let me use my audio interface rather than the built in mike?
    The basic answer is that Apple has not programmed the capture routine with this capability. As such, you can always send QT feedback requesting this feature be added as a future enhancement.

  • Why can't GB let me use 'electric guitar' option when using Nio 2/4 interface - I have to use real instrument and miss out on all the effects. Is this normal for all interfaces?

    Why can't GB let me use 'electric guitar' option when using Nio 2/4 interface - I have to use real instrument and miss out on all the effects. Is this normal for all interfaces? The Nio reads hte guitar but GB doesn't....

    Usually effects packages are AU plugins that would have no effect on track selection. Interfaces should have no control over what kind of track you can select. I really think something else is going on her maybe something you overlooked.
    Did you choose the input channel in the track info pane. Try both channel 1 mono or channel 2 mono. Make sure the track is record enabled.

  • When will apple let us use own on pictures for background?

    I am honestly a huge Apple Ipod brand and honestly would not buy anything else. however, the new Ipod nano 6g in my opinion was a little rushed. First of all i love the picture function that the Ipod has but i would like to see one of my own picture as the background not just the 11 or so preset backgrounds which to me....are a little feminineness. So, my question was when will we be able to have our own backgrounds, or why won't apple let us have our own background?

    Let Apple know your idea.
    Contact them here:
    http://www.apple.com/feedback/ipodnano.html

  • Anyone successfully using the credit card interface?

    I have heard that this interface is not really a 'mature' product. Has anyone implemented it, and if so, would you mind providing some info about how you got there? Thanks in advance!

    So my sister and I have our own separate iTunes accounts, and she has her set up with her credit card. She let me use her credit card on mine but it keeps saying the security code is invalid. Then the credit card company called about her credit card activity. Are you sure it's not impossible to use the same credit card on our different accounts?

  • Will using your own router allow loopback connections?

    SomeJoe7777 you are correct regarding the route of a given packet when using a WAN IP locally (NAT loopback). However will again state that NAT loopback does not work using a router behind the NVG589. As you stated it should...which is why the issue lies with the NVG589. Most likely something to do with IP passthrough mode on the NVG589 not being a true bridge mode which in turn does effect one's own router. Bottom line I encourage you to attempt NAT loopback yourself with a router behind the NVG589 and report your results. It wouldn't be the first time that ATT said something should work only to later admit it was a problem with their hardware.

    NAT loopback is defined as a function of a router where connections to ports on the outside IP address are translated and routed to the server defined in the router, even when the connection attempt comes from the "inside" portion of the network.
    e.g.. Let's say we have a router with an outside IP address of 99.99.99.99 (a public IP address), and the router has been configured so that inbound connections to port 80 on that WAN interface are translated to a destination address of 192.168.1.20 (on the inside network). This enables a web server running on the 192.168.1.20 machine to respond to web requests from the Internet, provided those web requests are coming in to 99.99.99.99.
    If another computer on the internal network, such as 192.168.1.101, can pull up the web site using http://99.99.99.99 (instead of the direct connection of http://192.168.1.20 ) then the router implements NAT loopback.
    Now, knowing that, let's review:
    If you use your own router, and it is the device doing the network address translation (NAT), that means it's outside address is x.x.x.x (a publically routable IP address), and it's inside addresses are private, in RFC 1918 address space. This can be set up with the U-Verse modems using DMZPlus (2Wire/Pace 3xxx series gateways) or IP Passthrough (Motorola NVG5xx series gateways).
    NAT loopback in this situation is completely dependent on the functionality of your own router. By definition, any NAT loopback request under this circumstance never leaves your network and your router, and thus never touches the U-Verse gateway at all.
    The bottom line is that if NAT loopback is not working with your router, then you either haven't configured your router properly, or your router doesn't support it. The ISP gateway has no bearing on this functionality whatsoever when configured in conjunction with your own router as described above.
     

  • Use of abstract and interface?

    when i use Abstract class or Interface.Which one is better?

    Depends on what you want to do. An interface is more general (in that it doesn't define any actual behavior) and allows you to mimic multiple inheritance (a class can implement any number of interfaces whereas it can only extend one class (abstract or otherwise)). Abstract is good if you have a common base of functionality that all of the implementers will be using.
    It's also fairly common to use both (i.e. the interface TableModel and the abstract class AbstractTableModel), so that someone who wants to completely write their own implementation is free to, while someone who wants to just extend or change the standard functionality could do that as well.

  • Use of declaring an interface inside an interface

    Hi
    Whats the use of declaring an interface inside an interface? I can make some guesses by my own but want to come up with some
    solid reasoning.
    So any view points are welcome
    public interface ParentInterface{
    interface ChildInterface{
    public void inside();
    thanks
    Harshit

    CeciNEstPasUnProgrammeur wrote:
    kajbj wrote:
    One reason could be that the outer interface has a method that takes a callback implementation as argument. The nested interface is in that case the contract that the callback method must implement. I don't see a reason to declare that callback interface at top level.That's what I meant. Although I see very few reasons (namely one - limited usage, which might change) not to declare it at top level, because you can't make it less visible, like one might do with an inner class implementing a public interface.
    There is no technical reason for it and no technical reason against it, and whether or not seems just to be a matter of personal taste.I agree. But it can also make it easier to navigate the code. Now people can see that the NotificationListener interface only is important if you are going to use or implement a processor (but that could kind of be done with packages as well)
    I just don't like the looks of "class Myclass implements SomeInterface.InnerInterface".Neither do I, and I would probably create an anonymous implementation that just delegates.

  • How to register new interface implementation?

    Hi,
    I have the following problem:
    There exists a self written webdynpro application. This application uses a Java Interface. The administrator of the application can add new functionality to the application by adding a new line to a table. He inserts the name of a class which implements that Java interface. This class has the new functionality.
    For each interface implementation the user of the webdynpro gets a value into a list. He can select an entry from this list. This value tells to the application that it has to create an object from the related java interface implementation.
    Now I wonder how I can tell to the webdynpro application that it knows all interface implementations which will come in the future? If I do not "register" or reference the new interface implementations, then I think the webdynpro application has ClassNotFound errors.
    The developers should make there own projects for each interface implementation an deploy them. But what must be done, that the webdynpro application knows them?
    Can you please give me some suggestions?
    Thank you and best regards,
    Marcus

    You can register a Mac, but not an accessory like the Time Capsule. Keep a copy of your sales receipt.....just in case.

  • Designs for interface/implementation factory APIs

    I've been building a complex data store for geographical information based on JNDI.
    The store is basically working but I've been trying to make the API for programs accessing it more regular.
    I'm dissatisfied with the way that new objects for addition to the store are instanciated. It's all a bit ad-hoc at the moment so I want to create a proper factory system, separating interface from implementation and allowing for the case where the interface has a different implentation for remote and local contexts.
    I'm thinking the best approach would be to have a single create method, probably as a member of the extended context interface.
    What I want to get is a sample of how programmers feal about different methods of passing creation parameters to such a factory method (or for that matter, to invite comments on the basic idea).
    One possibility would be as a Hashtable or Hashmap. Generic keys (like datastore path) would be defined as constants in the context or factory interface, type specific keys in the interface which is used to access the object being created.
    e.g.
    Hashtable fsCreate = new Hashtable(5);
    fgCreate.put(DataContext.PATH_KEY, "test.features");
    fgCreate.put(DataContext.FORMAT_KEY, format);
    fgCreate.put(DataContext.BOUNDS_KEY, boundaryRectangle);
    FeatureSet fs = (FeatureSet)dataContext.create(FeatureSet.TYPE_VALUE,fsCreate);Another possibility would be some kind of parameter bean, with an fundamental parameter class and different extensions for each type of object to be created.
    FeatureSetParams fsCreate = new fsCreate();
    fsCreate.setPath("test.features");
    fsCreate.setFormat(format);
    fgCreate.setBounds(boundaryRectangle);
    FeatureSet fs = (FeatureSet)dataContext.create(fgCreate);The Hashtable method has a slightly clumbsy feel, but it does avoid directly instanciating a whole bunch of new concrete classes (which seems to go against the spirit of interface/implementation separation).

    If there's a create method in the interface, wouldn't
    that make it accessible from anything that knows about
    the interface? This would nullify the factory
    pattern, wouldn't it?Not necesasrilly, that would depend how the create method was implemented. I already have a "retriever" object associated with each implentation class that can be retrieved from the data store. I can add a "create" method, effectively adding a factory class function to these. These retrievers are already registered with the concrete implentation of the JNDI Context.
    Granted the implentations are in several different packages, so I can't restrict acces to these retriever objects to the package level.

  • Can I send email using my own domain address with iCloud the way I can with gmail?

    Let's say I own mydomain.com and have a [email protected] email account.  I have set that up to forward to gmail, and that would be easy to switch to iCloud.  Here's the tricky part: gmail allows me to send email as [email protected]  I've been doing this for years and it works, but I'd like to switch from gmail to iCloud.  Can I set up this same behavior with an iCloud @me.com address (which I already have but haven't been using yet)?  I know I can obviously switch the forwarding of incoming mail to my @me.com address...  but can I send [email protected] email through iCloud the way I can with gmail?  All of my devices are Apple: a Mac Mini using Apple's Mail app, and an iPhone and an iPad both using the Apple email app, so I'd rather switch everything over from gmail to iCloud.
    P.S.  Awe, c'mon Apple.  Don't turn those fake addresses into links.  I just used them for the sake of giving an example.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • I switched phone with my brother and i could sucessfully restore everything to the new phone except my imessages. how can i restore them? and why this phone doesnt let my use my number, just my apple id for immesage/facetime? please somebody help me!!

    after restoring all my stuff to the new phone, i wanted to see my messages but i discovered that all my imessages are missing. i checked in settings and i dont know why but the new phone doesnt let me use my phone number for imessage or facetime, instead it's using just my apple id. any idea how can i switch to the phone number again? in my old phone i used both my number and email for imessages, so i think maybe thats why i cant see my immessages now. please somenone help me!! thank you so much

    Hi Katrina - I hear what you are saying about the problems. I've been using a BB Pearl here in Canada since January and I had the same problems with PocketMac from the start. iCal dates getting strangely duplicated after syncing and contacts in AddressBook groups getting listed twice on the BB. The only solution I used was to have the Mac always override the BB when syncing. NOt perfect but for me it was the simplest way to ensure the consistency of the data and my own sanity.
    If anyone has a better solution that actually allows a clean sync I'd love to hear it.

Maybe you are looking for

  • Database Connection Error 42000:[Microsoft][ODBC driver for oracle] Syntax

    Hi,   This is Sathish, I am trying to create a report and retrieve data through stored procedure using ODBC Connection. When connecting to the Stored Procedure it is showing Database Connection Error 42000:[Microsoft][ODBC driver for oracle] Syntax e

  • How can I make a book in iPhoto using some photos and a lot of text-- recipes--written in ms Word2011?

    I'm trying to make and have printed, a small cookbook of favorite recipes using my photos as illustrations. Given the themes in iPhoto, writing in Word2011, it doesn't seem to work as a click and drag into designated spaces. Only photos work with too

  • Problem creating Object Proxy

    Hi Gururs!! I want to create an object Proxy through SE80 using a WSDL file. When I try this, I get the error message: <i>"Cannot generate proxy (object schema missing in WSDL).</i> I think the conflictive part of the WSDL is: - <s:element name="GetP

  • ITunes card in France

    Is there a forum in French? For the holidays I told my family to get me an iTunes gift card here in France, in Brittany (Country side). I come from the us. I told them that it should be easy and you could find them everywhere. Well I was wrong! Impos

  • Using a camcorder tape as backup

    If there is only a very small amount of footage I want to use on a tape, is it possible to capture all necessary scenes, edit them and then export them back on to a tape, using dv out to a tape recorder, without compressing any of the footage, i.e. L