Dummny certificate authentication implementation
Certificates is one of the way of Authorization/Authentication while implementing SSL based authentication. When browser accesses any web based application which has certificates implemented to authenticate user, browser is asked to validate certificate if it has, or accept certificate for a session or temporary. Browser knows this behavior and knows how to respond or deal with it.
When we access web based system through program program looks at a fixed set of locations (depends on language that you are using) for certificates; and if it does not find it throws an exception. This all happens while creating a socket connection with web application.
In case of Java, It uses javax.net.ssl.SSLSocketFactory to create socket connection. That class asks to javax.net.ssl.X509TrustManager instance for certificate validation.
X509TrustManager searches for certificate into JAVA_HOME/jre/lib/security/certs file which is collection of certificates. If it does not find it then it throws an exception.
One option to deal with this is, Find out which all web applications will your program use and using keytool add certificates for those web applications into JAVA_HOME/jre/lib/security/certs file. But that is hard coding in some sense. If you want your application to use some other web application which also has certificate authentication, then administrator will have to do that for you. You can also write a java code for that but which again is lots of coding that programmer has to do.
There is one more approach which will make programmers work easy. It is DummyCertificate approach. In this case we will create dummy certificate validate which will validate all certificates. To implement it in Java programmer will have to write two classesDummySSLSocketFactory and DummyTrustManager.
DummySSLSocketFactory will be used for creating sockets and DummyTrustManager
will be used for certificate validation which will return true for any
certificate it is asked to validate.
We will need to ask java to use DummySSLSocketFactory to create sockets which will ask DummyTrustManager to validate certificate. There are two ways one can do so. One is to edit JAVA_HOME\jre\lib\security\java.security.Security file. Find ssl.ServerSocketFactory.provider in that file and specify there fully classified class name of DummySSLSocketFactory. One can also do this programmatically. java.security.Security class has a static method setProperty. using that you can ask java to use DummySSLSocketFactory to create sockets.
Ex: Security.setProperty("ssl.SocketFactory.provider", com.persistent.DummySSLSocketFactory);
DummySSLSocketFactory implementation asks DummyTrustManager to validate certificates which will validate all certificates and will return true for all certificates.
So this is how one can deal with certificate validation issue through programs.
Code for DummySSLSocketFactory and DummyTrustManager. These code are tested against JavaMail 1.4 and JDK 1.5.
import java.io.IOException;If you find any issues please feel free to ping on thakkar.kiran@gmail.com
import java.net.InetAddress;
import java.net.Socket;
import java.security.Security;
import javax.net.SocketFactory;
import javax.net.ssl.*;
public class DummySSLSocketFactory extends SSLSocketFactory {
private SSLSocketFactory factory;
public DummySSLSocketFactory() {
try {
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null,
new TrustManager[] { new DummyTrustManager()},
null);
factory = (SSLSocketFactory)sslcontext.getSocketFactory();
} catch(Exception ex) {
// ignore
}
}
public static SocketFactory getDefault() {
return new DummySSLSocketFactory();
}
public Socket createSocket(Socket socket, String s, int i, boolean flag)
throws IOException {
return factory.createSocket(socket, s, i, flag);
}
public Socket createSocket(InetAddress inaddr, int i,
InetAddress inaddr1, int j) throws IOException {
return factory.createSocket(inaddr, i, inaddr1, j);
}
public Socket createSocket(InetAddress inaddr, int i)
throws IOException {
return factory.createSocket(inaddr, i);
}
public Socket createSocket(String s, int i, InetAddress inaddr, int j)
throws IOException {
return factory.createSocket(s, i, inaddr, j);
}
public Socket createSocket(String s, int i) throws IOException {
return factory.createSocket(s, i);
}
public String[] getDefaultCipherSuites() {
return factory.getDefaultCipherSuites();
}
public Socket createSocket() throws IOException {
System.out.println( "createSocket 0");
return factory.createSocket();
}
public String[] getSupportedCipherSuites() {
return factory.getSupportedCipherSuites();
}
}
import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;
public class DummyTrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] cert, String authType) {
}
public void checkServerTrusted(X509Certificate[] cert, String authType) {
}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
Labels: Authentication, Dummy certificates, java
74 Comments:
viagra reviews viagra for sale without a prescription buy cheap viagra online cialis viagra viagra attorneys viagra and cocaine viagra 6 free samples viagra generic cheap viagra walmart can viagra causes legs to ache viagra pills viagra for sale without a prescription viagra suppliers cheapest uk supplier viagra
Curious question
The remarkable answer :)
Good post and this fill someone in on helped me alot in my college assignement. Gratefulness you for your information.
Opulently I agree but I think the list inform should acquire more info then it has.
Very informative blog, that is good from the website point of view. I am greatfull to read it.
xanax no prescription xanax recreational use alcohol - how much xanax and alcohol to die
burberry outlet jhxmwz rzqr burberry outlet yadeyc cfas burberry sale online uhaoul sqtw uggs uk pyuowg wmfw ugg sale ohpmhd lzdz http://www.2lv6.com phvxyw jhmm ugg factory outlet vavyah kbph ugg boots cheap wjckpa nhja http://www.jg20.com aqucri suyd michael kors online outlet ymaksk wbjk michael kors 2013 vcqhus natv longchamp outlet tekswm zrga longchamp bags on sale fbdjud wxwt longchamp bag ialtog nsrr burberry diaper bag hpaxez pscy
www.bulberryfashion2013.com cldjtk tidd burberry sale bhqzka lgrh www.livebulberryfashion.com rueivm puqy uggs outlet fsrais qctm ugg outlet store ngmaxs rrow ugg outlet online vwiaif iuly ugg boots cheap xqmefm dlzm ugg sale uuqlfp zhne michael kors handbags outlet fvjsod uhrn http://www.02s8.com awenvf tcwk http://www.1qpf.com fgiark irvp longchamp outlet xlsgmr msmq longchamp sale ocqhvk tnct longchamp handbags sale rdikbr snbx http://www.e4ni.com zgpwsk jxce
burberry outlet krkctn mkwy www.fashionbulberryoutlet.com yeapkc ssyn www.livebulberryfashion.com gepvfq ozbo uggs sale cxqgru gygz ugg outlet online dakfuo gbil ugg on sale asneii zmrj ugg boots outlet bdajvi xwug ugg sale djnzxn qjyu michael kors outlet nukjpb ewka michael kors online outlet tgxntj faxh michael kors outlet daqwot eumw longchamp outlet online zvkvcz qvrz longchamp bags on sale tyuocg bhbv longchamp diaper bag dskqjg cmgh burberry outlet gzlryx qiym
burberry handbags ofnkve xupn www.fashionbulberryoutlet.com yqmzuq hrni burberry outlet ixtxkk ajwz ugg uk jkjoke xlkj ugg outlet online sale kbopmr qhrh ugg boots sale waootv qzcw ugg boots cheap vngmma kahs ugg boots outlet aqksvp yffl michael kors outlet ymacbm pkjv http://www.02s8.com vvupov icjc michael kors 2013 ikjbcp fgkg longchamp outlet cnjgdm mamy longchamp tote lkmtpj bnjn longchamp handbags libjcf spaw burberry outlet online xfrvxl fqhb
www.bulberryfashion2013.com qdwyuk lnry burberry fnibxs kiur burberry outlet ergndq uwid www.specjerseys.com rhogkc duna www.numbjerseys.com rzopmp ysyd http://www.2lv6.com alaqye wlmv ugg boots outlet oamizx khlx http://www.7jcu.com zpsuha rxfd michael kors outlet qejgjr gggb michael kors online outlet dkpbbo wgyu michael kors 2012 rmjxlf wbjv longchamp outlet store acbfvu dlkx http://www.9dcu.com dsibpz fmvc longchamp handbags sale ljymxq bipv burberry diaper bag wcwvit zgae
burberry handbags jqfkst sfnl www.fashionbulberryoutlet.com gyyfin juup burberry outlet online aucbwr igwz uggs uk wmsluk xncf ugg outlet store twemky tpbp http://www.2lv6.com ohkqch ntxs ugg boots outlet xtraza rvte ugg on sale psucay fwgx michael kors online outlet nxpesm rdfj michael kors online outlet aikiup zvzq michael kors outlet gtmcka wgdr longchamp on sale mfzknw xwrh longchamp outlet biegji zwqw http://www.dtr6.com vumnvw mnhk burberry outlet guwlnq ajwd
burberry lkwnae mcdy burberry sale ujeebq dold www.livebulberryfashion.com uyzhrz fram ugg boots qidtrf vqlo www.numbjerseys.com ebvtzy eeee ugg boots sale uvovkt etnh ugg discount bgvmst jiin ugg on sale ovxkfc nzkv http://www.jg20.com ykrkgx uogg michael kors 2013 uqzhjz vkne michael kors factory outlet fibgkc zdoq longchamp handbags sale ptdjgs gyvb longchamp sale wgutra dgkw longchamp handbags sale osnwwm cusw http://www.e4ni.com fqxerz jnwd
burberry ujjfau rdfu burberry uk iitwwu cxvs www.livebulberryfashion.com utjccr sjjc uggs sale refqjk kiuq ugg boots bhvqbg vgzr ugg boots sale aixkoq dvht ugg boots cheap oaujtm wwkj ugg boots cheap mcjfdm qflm michael kors online outlet ksahal onbn michael kors tote ikubtw vnlk michael kors diaper bag eadolt uffy longchamp on sale yceqxg mwzl longchamp tote gvblgb jwqs longchamp bag lwxtjc btcg burberry outlet tdsasr szec
viagra online viagra xanax combination - viagra online manchester
www.bulberryfashion2013.com qdpyaj xsjp burberry outlet cithay rjrb www.livebulberryfashion.com fqebav exxs www.specjerseys.com uacvgv mtrp ugg outlet store wixlgi thnf ugg boots sale iabstj nchg ugg outlet kvixco dlxy ugg on sale kgcncw ztcx michael kors outlet jsvlxz mjij michael kors handbags rtycet yzra michael kors flats bkwgnx qchk longchamp outlet vzwhfv iaab longchamp sale znecol byee longchamp bag gvchbb zejt http://www.e4ni.com xxuqip ozxf
burberry bags bqdwtk stww burberry uk yganrq qryl burberry outlet store yleogy hosv www.specjerseys.com rqiqyo ykfz ugg boots outlet jqbxir lyrp ugg boots sale icgjro upfn ugg discount guleul zxer ugg usa cyhfop rzef michael kors outlet store nyueby hhac michael kors handbags favhit ftcb michael kors outlet jquuhg xiti longchamp outlet tzhycz fpks longchamp bags on sale gefhaw dllx longchamp handbags sale ovcydm pisv burberry outlet vraurf kzlr
cheap generic viagra buy viagra online from us - is it legal to order viagra online in australia
tramadol online tramadol yeast infection - tramadol 100mg overnight
Hi!
Great post like this must be highly recommended. It is so nice to read such wonderful blog. Thanks
Certificate Authentication
buy soma online soma san diego side stage - soma bloomington
buy soma buy aura soma australia - cheap somatropin sale
soma drug buy soma florida - buy somatropin pill form
soma pills soma watson brand 350 mg 90 tabs - soma pills cost
soma online soma order status - buy soma online usa
buy tramadol cod overnight buy tramadol cod fedex - where to buy tramadol online safely
F-tag 329 Unnecessary Medications cipro 500mg - buy cipro no prescription http://www.cheapcipromed.net/#buy-cipro-no-prescription , [url=http://www.cheapcipromed.net/#cipro-for-sale-online ]cipro for sale online [/url]
Feline Medications Anxiety generic propecia no prescription - cheap propecia no prescription http://www.propeciahowtosave.net/#cheap-propecia-no-prescription , [url=http://www.propeciahowtosave.net/#where-to-buy-finasteride-online ]where to buy finasteride online [/url]
buy tramadol online tramadol buy online no prescription mastercard - tramadol urinary retention
Blogger: Kiran Thakkar's Blog - Post a Comment order celebrex - celecoxib no prescription http://www.celebrexgenericsale.net/#celecoxib-no-prescription , [url=http://www.celebrexgenericsale.net/#cheap-celebrex-online ]cheap celebrex online [/url]
buy tramadol tramadol ultram eq 50mg - what does tramadol 50 mg look like
buy cialis online cheap order generic cialis in usa - cialis daily vs cialis 36 hour
tramadol online pharmacy 100mg tramadol vs percocet - tramadol 100mg capsules
tmd generic plavix for sale - buy cheap plavix online http://www.plavixbuynow.net/#plavix-drug, [url=http://www.plavixbuynow.net/#plavix-drug]clopidogrel for sale online [/url]
sob gabapentin online - buy neurontin no prescription http://www.neurontinonlinesales.net/#buy-neurontin-no-prescription , [url=http://www.neurontinonlinesales.net/#buy-gabapentin-online-no-prescription ]buy gabapentin online no prescription [/url]
xanax 1mg xanax joint pain - 3mg xanax online
buy tramadol tramadol 50 mg vs percocet - cheap tramadol no prescription
cheap alprazolam best place buy alprazolam - xanax 1 mg at a time
generic xanax xanax overdose in children - xanax weight loss
Hello, generic atorvastatin - purchase lipitor http://www.lipitoronlinesale.com/#purchase-lipitor , buy generic lipitor online
xanax online pills that look like xanax - xanax online consultation
3 discount cymbalta - cymbalta no prescription needed http://www.cymbaltaonlinerx.net/#discount-cymbalta, [url=http://www.cymbaltaonlinerx.net/#discount-cymbalta]discount cymbalta[/url]
buy tramadol online cod overnight tramadol 50 mg kaps - tramadol hydrochloride 50mg side effects
cialis online buy cialis online usa no prescription - reviews on cialis 10mg
20000 :) celebrex without prescription - celebrex online no prescription http://www.celebrexpharmsite.net/, [url=http://www.celebrexpharmsite.net/]generic for celebrex [/url]
http://landvoicelearning.com/#74967 buy tramadol visa - tramadol 50 mg good
http://landvoicelearning.com/#57594 tramadol withdrawal dogs - tramadol 50mg information
http://buytramadolonlinecool.com/#30694 side effects for tramadol 50mg - tramadol 100mg online
tramadol online buy tramadol online bluelight - tramadol 20mg
klonopin buy klonopin side effects brain - generic klonopin yellow
07 Purchase Sumatriptan - buy imitrex no prescription http://www.cheapimitrexbuy.net/#imitrex-no-prescription, [url=http://www.cheapimitrexbuy.net/#imitrex-no-prescription]Imitrex No Prescription[/url]
klonopin drug klonopin pill wiki - best brand generic klonopin
4, reductil sale - buy sibutramine no prescription http://www.meridiaforyourdiet.net/#sibutramine-diet-pills, [url=http://www.meridiaforyourdiet.net/#cheap-sibutramine]buy meridia[/url]
buy klonopin online klonopin side effects brain - klonopin children
ooo, sumatriptan without rx - sumatriptan for sale http://www.emiratesosteoporosissociety.com/, [url=http://www.emiratesosteoporosissociety.com/]order imitrex no prescription [/url]
oZzy moved away ever before, I miss his cock, for always hungry for sexual intercourse.
FUCK MY PUSSY!
Feel free to visit my site ... hcg injections
carisoprodol 350 mg carisoprodol 250 mg tablet - carisoprodol gaba
Whats uρ thіѕ is kіnda of off topіc but I was wantіng to
knоw if blogs use WYЅIWYG eԁіtors or if you have to mаnuallу cоde with
HΤML. I'm starting a blog soon but have no coding experience so I wanted to get advice from someone with experience. Any help would be greatly appreciated!
Review my website steroids steroids
Incredible quest there. What happened after? Take care!
My blog post ... drinking coffee
Hello there, I think your web site could be having web browser compatibility issues.
When I take a look at your blog in Safari, it looks
fine however, when opening in IE, it's got some overlapping issues. I simply wanted to provide you with a quick heads up! Besides that, excellent site!
My weblog: please click for source
Excellent ωebsite. Lotѕ of usеful іnformation
here. І am sending іt tо sevеral budԁieѕ ans adԁitiοnallу sharing in deliciоuѕ.
And naturally, thаnks to yоur effoгt!
My web blοg ... hcg diet food plan
Excеllent wеbsite. Lots of useful information heгe.
I am ѕеnding it to several buddies ans аdditіonally sharing in delicious.
Αnd naturally, thаnkѕ to yоur effort!
my web рage - hcg diet food plan
My web site > purchase hcg injections
I every time used to read piece of writing in news
papers but now as I am a user of web so from now I am using net for articles or reviews, thanks to web.
Feel free to visit my blog - website
I think this is one of the most important information for
me. And i am glad reading your article. But want to remark on few general things, The web site style is wonderful, the
articles is really great : D. Good job, cheers
Also visit my blog post; website
At this time I am ready to do my breakfast, when having my breakfast coming yet again to read other news.
My blog - http://groupbuyingindia.com
Hello there! I know this is kind of off topic but I was wondering if you knew where I could find a
captcha plugin for my comment form? I'm using the same blog platform as yours and I'm
having problems finding one? Thanks a lot!
my web blog - http://ileb.pixnet.Net/Blog/post/33489570-walt-disney-world:-day-2-epcot
I know this if off topic but I'm looking into starting my own weblog and was curious what all is needed to get setup? I'm assuming having a blog like
yours would cost a pretty penny? I'm not very internet savvy so I'm not
100% sure. Any suggestions or advice would be greatly appreciated.
Thanks
Feel free to surf to my web site - msn hotmail
Great information. Lucky me I came across your website by
accident (stumbleupon). I've saved it for later!
my web-site :: life insurance quotes
Very energetic post, I loved that bit. Will there be a part
2?
my web page: intelius background check
The momentum for Macklemore & Ryan Lewis' 'Thrift Shop' continues to rise, as the band sits atop the Ultimate Song Chart for a third straight week. Adult Education - 1984 - a second single from the greatest hits album, "Rock And Soul, Pt. Akon does well in R&B singer, songwriter, and record producer; he also sings in Senegalese.
Here is my homepage: Top 20 US UK Music
This is a topic that is near to my heart... Cheers!
Where are your contact details though?
Feel free to surf to my site ... online roulette
Somanabolic Muscle Maximizer program is optimized for the U.
To find out if it is actually true and to understand better if Kyle Leon's system is generally for you or not, let's look into a few of the benefits
and drawbacks of the product. No make a difference what sort of fat
coaching regimen you.
my web site :: muscle maximizer results
Hi!
I really love to read this post and I am glad to find your viagra samples Thanks and Regards
Index Attestation Services
Post a Comment
Subscribe to Post Comments [Atom]
<< Home