How can I list the available Cipher algorithms?

后端 未结 5 973
清歌不尽
清歌不尽 2020-11-28 15:47

I am getting a Cipher implementation with Cipher.getInstance(String algorithm). I am under the impression that the available algorithm names that I may pass di

5条回答
  •  清酒与你
    2020-11-28 16:20

    The doc of Cipher.getInstance() says:

    Note that the list of registered providers may be retrieved via the Security.getProviders() method

    Clicking on the link leads to the doc of Provider, which has a method getServices() documented by :

    Get an unmodifiable Set of all services supported by this Provider.

    And clicking on the link leads to the doc of Provider which has a getAlgorithm() method.

    Note that this is a very empirical method. A more logical method would be to read the documentation of the crypto libraries you're using. It must contain the list of supported algorithms.

    Whatever the method you choose, reading the documentation helps a lot.

提交回复
热议问题