TLS-handshake with own random numbers in Java

ぐ巨炮叔叔 提交于 2019-12-13 18:28:49

问题


I have a a piece of hardware which realises some crypto functions like random number generation (e.g a SmartCard). I would like to use this hardware during my TLS hadshake. Is it possible to do this, without implementing the TLS-Handshake by my own?

I tried to extend the class "SecureRandom" but the "next" methode is final so I can't override it so that it will return 'my' genetrated numbers.

So basically I would like to "outsource" all the crypto functions without implementing the TLS handshake in JAVA.

Thanks


回答1:


Extend SecureRandomSpi instead. Then either implement a Provider or do a cheap SecureRandom as

  public MySecureRandom() 
    throws NoSuchAlgorithmException, NoSuchProviderException {
      super(new MySecureRandom(),null);
  }

(The implementation of next relies on the given SPI)

Then pass your SecureRandom as an argument to SSLContext.init.



来源:https://stackoverflow.com/questions/15502544/tls-handshake-with-own-random-numbers-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!