How can I get issuerNameHash and issuerKeyHash from PEM or DER certificates? I need to get these values ​​from pem and der files. Is there Python and C code or openssl command for these results?
Example cert in PEM format:
   -----BEGIN CERTIFICATE-----
    MIIDTTCCAjWgAwIBAgIBATANBgkqhkiG9w0BAQsFADBHMRQwEgYDVQQDDAtSb290
    IENBIFJTQTEMMAoGA1UECgwDT0NBMQswCQYDVQQGEwJOTDEUMBIGCgmSJomT8ixk
    ARkWBE9DVFQwIBcNMjAwMjEyMTgxMDI3WhgPMjA2MDAyMDIxODEwMjdaMEcxFDAS
    BgNVBAMMC1Jvb3QgQ0EgUlNBMQwwCgYDVQQKDANPQ0ExCzAJBgNVBAYTAk5MMRQw
    EgYKCZImiZPyLGQBGRYET0NUVDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
    ggEBAJ0gKwiY8Yj5T+SwZCQB3evp2y65BoVdBlnL91FzpuZ1LP9i0C4dQVcjN59W
    d3lDskb9njjm41ds57zAUEesMwomFy+DfXd2zDSoBpmFCJuoW3bD+8xN1ISfrEI0
    vQPTMRtyfaue1CYo55+4Fkv0zLEbjSOx3Sl+9ciwQ4i/x6hDjclu5JXx9Bom/oR2
    +xlHZEfpGogyDvQB3al+GsOCOk9Y7kA8EaVDPLeeI+CJdOS4syoZdyEiA6cO+kAH
    0tE+Rl5Pqf3wabuO1ebTLenswa7xLrUGQ9rURmXTJQ2+23c3YsXOGgMZ5M7H2R2i
    sOt2S62t28aVs62+PwQrqh/X4vkCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
    BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFNSqKyVEMyNJoqivS0wO565HVoOiMA0G
    CSqGSIb3DQEBCwUAA4IBAQAtxUSnf+pb+dgLPAtLgoMLsc+CgvoeEpHF1aLWNgcc
    VSC2L0frxtpERl3xjxE9ttc+3mE6KA2UQFhf4Md4vCPf60GZw44rFl1Rj9PwrLA9
    c2AtLjcDkthhmZylgEjorzyox3wVW5pbOWRP38lDz9gpqJCzTYmmm+9skNS09/gq
    M5lYhAqBjKjLiyKylwKWdw9EOkUxnSlg4aicn83+1cdD0iNM+z6lIP5cxvQu2/f6
    8KJ9JkTofQzdyPH4l/JvuSwmXnfWR3O8JTJjAq8Z5XoqduJXhEB73Xvamdah1PB0
    BJHAh45odouHCmtG6TqRUgoFVNZDLdNurVXXzn5cnL+t
    -----END CERTIFICATE-----

Example output:
  &quot;certificateHashData&quot;: {
    &quot;hashAlgorithm&quot;: &quot;SHA256&quot;,
    &quot;issuerNameHash&quot;: &quot;f405cb5ba4efe79d4863495e186413c551f7d98dd021030573e169146a763056&quot;,
    &quot;issuerKeyHash&quot;: &quot;3e1518dc6e867ea55d699922be7be6898fb5abf459709c086e17ac4760682da9&quot;,
    &quot;serialNumber&quot;: &quot;1&quot;
    ]}
Expanding on what Maarten shows, openssl asn1parse can display the details, AND can also extract encoded parts of the certificate (or other ASN.1 structure):
&gt;openssl asn1parse -i &lt;cry87661.crt
    0:d=0  hl=4 l= 845 cons: SEQUENCE
    4:d=1  hl=4 l= 565 cons:  SEQUENCE
    8:d=2  hl=2 l=   3 cons:   cont [ 0 ]
   10:d=3  hl=2 l=   1 prim:    INTEGER           :02
   13:d=2  hl=2 l=   1 prim:   INTEGER           :01
   16:d=2  hl=2 l=  13 cons:   SEQUENCE
   18:d=3  hl=2 l=   9 prim:    OBJECT            :sha256WithRSAEncryption
   29:d=3  hl=2 l=   0 prim:    NULL
   31:d=2  hl=2 l=  71 cons:   SEQUENCE
   33:d=3  hl=2 l=  20 cons:    SET
   35:d=4  hl=2 l=  18 cons:     SEQUENCE
   37:d=5  hl=2 l=   3 prim:      OBJECT            :commonName
   42:d=5  hl=2 l=  11 prim:      UTF8STRING        :Root CA RSA
   55:d=3  hl=2 l=  12 cons:    SET
   57:d=4  hl=2 l=  10 cons:     SEQUENCE
   59:d=5  hl=2 l=   3 prim:      OBJECT            :organizationName
   64:d=5  hl=2 l=   3 prim:      UTF8STRING        :OCA
   69:d=3  hl=2 l=  11 cons:    SET
   71:d=4  hl=2 l=   9 cons:     SEQUENCE
   73:d=5  hl=2 l=   3 prim:      OBJECT            :countryName
   78:d=5  hl=2 l=   2 prim:      PRINTABLESTRING   :NL
   82:d=3  hl=2 l=  20 cons:    SET
   84:d=4  hl=2 l=  18 cons:     SEQUENCE
   86:d=5  hl=2 l=  10 prim:      OBJECT            :domainComponent
   98:d=5  hl=2 l=   4 prim:      IA5STRING         :OCTT
  104:d=2  hl=2 l=  32 cons:   SEQUENCE
  106:d=3  hl=2 l=  13 prim:    UTCTIME           :200212181027Z
  121:d=3  hl=2 l=  15 prim:    GENERALIZEDTIME   :20600202181027Z
  138:d=2  hl=2 l=  71 cons:   SEQUENCE
  140:d=3  hl=2 l=  20 cons:    SET
  142:d=4  hl=2 l=  18 cons:     SEQUENCE
  144:d=5  hl=2 l=   3 prim:      OBJECT            :commonName
  149:d=5  hl=2 l=  11 prim:      UTF8STRING        :Root CA RSA
  162:d=3  hl=2 l=  12 cons:    SET
  164:d=4  hl=2 l=  10 cons:     SEQUENCE
  166:d=5  hl=2 l=   3 prim:      OBJECT            :organizationName
  171:d=5  hl=2 l=   3 prim:      UTF8STRING        :OCA
  176:d=3  hl=2 l=  11 cons:    SET
  178:d=4  hl=2 l=   9 cons:     SEQUENCE
  180:d=5  hl=2 l=   3 prim:      OBJECT            :countryName
  185:d=5  hl=2 l=   2 prim:      PRINTABLESTRING   :NL
  189:d=3  hl=2 l=  20 cons:    SET
  191:d=4  hl=2 l=  18 cons:     SEQUENCE
  193:d=5  hl=2 l=  10 prim:      OBJECT            :domainComponent
  205:d=5  hl=2 l=   4 prim:      IA5STRING         :OCTT
  211:d=2  hl=4 l= 290 cons:   SEQUENCE
  215:d=3  hl=2 l=  13 cons:    SEQUENCE
  217:d=4  hl=2 l=   9 prim:     OBJECT            :rsaEncryption
  228:d=4  hl=2 l=   0 prim:     NULL
  230:d=3  hl=4 l= 271 prim:    BIT STRING
  505:d=2  hl=2 l=  66 cons:   cont [ 3 ]
  507:d=3  hl=2 l=  64 cons:    SEQUENCE
  509:d=4  hl=2 l=  15 cons:     SEQUENCE
  511:d=5  hl=2 l=   3 prim:      OBJECT            :X509v3 Basic Constraints
  516:d=5  hl=2 l=   1 prim:      BOOLEAN           :255
  519:d=5  hl=2 l=   5 prim:      OCTET STRING      [HEX DUMP]:30030101FF
  526:d=4  hl=2 l=  14 cons:     SEQUENCE
  528:d=5  hl=2 l=   3 prim:      OBJECT            :X509v3 Key Usage
  533:d=5  hl=2 l=   1 prim:      BOOLEAN           :255
  536:d=5  hl=2 l=   4 prim:      OCTET STRING      [HEX DUMP]:03020106
  542:d=4  hl=2 l=  29 cons:     SEQUENCE
  544:d=5  hl=2 l=   3 prim:      OBJECT            :X509v3 Subject Key Identifier
  549:d=5  hl=2 l=  22 prim:      OCTET STRING      [HEX DUMP]:0414D4AA2B2544332349A2A8AF4B4C0EE7AE475683A2
  573:d=1  hl=2 l=  13 cons:  SEQUENCE
  575:d=2  hl=2 l=   9 prim:   OBJECT            :sha256WithRSAEncryption
  586:d=2  hl=2 l=   0 prim:   NULL
  588:d=1  hl=4 l= 257 prim:  BIT STRING

The SEQUENCE beginning at 31 is the Issuer name (and the one beginning 138 is the Subject name, which is the same as the Issuer in this cert because this cert is a selfsigned cert for a root CA) and the BIT STRING at 138 is the subjectPublicKey field within the subjectPublicKeyInfo substructure, which only for a selfsigned cert is the same as the issuer key, so:
&gt;openssl asn1parse -i &lt;cry87661.crt -strparse 31 -out cry87661.name
[snipped]
&gt;openssl asn1parse -i &lt;cry87661.crt -strparse 230 -out cry87661.keyx
[snipped]
&gt;dir cry87661*
21/01/20  19:11             1,224 cry87661.crt
21/01/20  19:27               270 cry87661.keyx
21/01/20  19:13                73 cry87661.name

but these don't match your values:
&gt;openssl sha256 &lt;cry87661.name
(stdin)= e60bd843bf2279339127ca19ab6967081dd6f95e745dc8b8632fa56031debe5b

&gt;openssl sha256 &lt;cry87661.keyx
(stdin)= 89ea6977e786fcbaeb4f04e4ccdbfaa6a6088e8ba8f7404033ac1b3a62bc36a1