java - How to extract the digest algorithm from a X509Certificate -


i can extract oid , name of signature algorithm x509certificate instance such "sha256withrsa" how extract name of digest algorithm e.g. "sha256".

is there way beside string splitting "with" or fixed mapping of oid's?

side question: safe split "with"?

a certificate contains signature algorithm oid maps unique couple digest/algorithm. therefore easiest way found digest algorithm use mapping table oid -> digest algo.

unfortunately know no centralized location can find these oid. can collected in these rfc:

parsing algorithm name , splitting on "with" should work these limitations

  • it may work oracle cryptography provider (see documentation on signature algorithm naming conventions). provider, own certificate implementation, may use incompatible naming convention.
  • if algorithm unknown getsigalgname() method return string of form oid.a.b.c.d.... instance sha256withdsa algorithm not supported old java6 , printed oid.2.16.840.1.101.3.4.3.2

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -