しかし、実際には私の出力は別のものです。誰が私が間違っているのか考えていますか?
これがOpenSSLの使用方法です...
$ cd openssl-1.0.2-src
$ grep -R X509_subject_name_hash *
apps/x509.c: BIO_printf(STDout, "%08lx\n", X509_subject_name_hash(x));
apps/x509.c: BIO_printf(STDout, "%08lx\n", X509_subject_name_hash_old(x));
crypto/x509/x509.h:unsigned long X509_subject_name_hash(X509 *x);
crypto/x509/x509.h:unsigned long X509_subject_name_hash_old(X509 *x);
crypto/x509/x509_cmp.c:unsigned long X509_subject_name_hash(X509 *x)
crypto/x509/x509_cmp.c:unsigned long X509_subject_name_hash_old(X509 *x)
...
次に、見てapps/x509.c
:
...
} else if (subject_hash == i) {
BIO_printf(STDout, "%08lx\n", X509_subject_name_hash(x));
}
...
そして、宣言は次のようになります。
unsigned long hash = X509_subject_name_hash(cert);
それで:
fprintf(stdout, "%08lx\n", hash);
また、OpenSSL は、OpenSSL 1.0.1 前後でサブジェクト ハッシュの計算方法を変更しました。そのため、X509_subject_name_hash
and がありX509_subject_name_hash_old
ます。
OpenSSL 0.9.8 (Mac OS X 10 など) を使用または比較している場合は、Generate Subject Hash of X509Certificate in Java を参照してください。Java ではありますが、サブジェクト ハッシュの OpenSSL 処理について詳しく説明しています。