Error While using Kite Connect java library

sachin_dp1942
Hi,
I am using java library to use kite connect APIs and getting following exception .
Please let me know what is my mistake?

This error comes at following line of code:

User user = kiteConnect.generateSession(REQUEST_TOKEN, API_SECRET);

REQUEST_TOKEN is my request token which i got through below url by giving my api_key:
https://kite.trade/connect/login?v=3&api_key=

and API_SECRET i got from my https://developers.kite.trade/apps section

INFO: <-- HTTP FAILED: javax.net.ssl.SSLKeyException: RSA premaster secret error
javax.net.ssl.SSLKeyException: RSA premaster secret error
at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:299)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:83)
at com.zerodhatech.kiteconnect.KiteConnect.generateSession(KiteConnect.java:180)
at com.tradeMachine.util.KiteClient.main(KiteClient.java:56)
Caused by: java.security.NoSuchAlgorithmException: SunTls12RsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.(KeyGenerator.java:169)
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 34 more
  • sujith
    Can you check what is the java version you are using?
    We use java 1.8.0_121.
    This doesn't seem like a javakiteconnect error, this is something related to setup.
  • sachin_dp1942
    I have fixed this issue.Sujith, Please let me know how credits works ? it is based on number of APIs hits i make to kite connect? or it is fixed for a month irrespective of the calls i make to Kite connect from my system in a month.
  • sachin_dp1942
    Sujith, I need historical data for 15 min candles for NIFTY50 AND nifty bank for last 2-3 years (whatever duration is available at zerodha) ? is it avaliable? i am using kite connect java library.I want to make sure before subscribing for HISTORICAL data APIs.
  • sachin_dp1942
    sachin_dp1942 edited December 2018
    @sujith Hi Sujith, Please respond as i have to subscribe for Kite Historical subscription only if NIFTY and BANK NIFTY index 15 min candle data for 2-3 years are available. From the links you had provided i can get to know about API request/response but not about indexes for which i can get data as i have seen in forum for some index it is not avaiable.
    So please confirm for NIFTY 50 and NIFTY Bank indexes regarding 15 min candle historical data for 2-3 years.
    Please specifiy the indexes for which i will get intraday candle historical data for 2- 3 years.
  • rakeshr
    rakeshr edited December 2018
    @sachin_dp1942
    Yes,NIFTY 50 and NIFTY BANK Index Intraday data is available from 2015. We do provide historical data for major indices.

    Edit: NSE INDICES
Sign In or Register to comment.