當前位置: 首頁>>代碼示例>>Python>>正文


Python CertUtils.print_cert_info方法代碼示例

本文整理匯總了Python中CertUtils.print_cert_info方法的典型用法代碼示例。如果您正苦於以下問題:Python CertUtils.print_cert_info方法的具體用法?Python CertUtils.print_cert_info怎麽用?Python CertUtils.print_cert_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CertUtils的用法示例。


在下文中一共展示了CertUtils.print_cert_info方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1:

# 需要導入模塊: import CertUtils [as 別名]
# 或者: from CertUtils import print_cert_info [as 別名]
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import tempfile, os, sys, random

libpath = os.path.abspath("../psm_common_py")
sys.path.append(libpath)

import CertUtils

dest_dir = os.getcwd()
db = tempfile.mkdtemp()

serial = random.randint(100, 40000000)
name = "client-cert"
[key, cert] = CertUtils.generate_cert_generic(db, dest_dir, serial, "rsa",
                                              name, "")
CertUtils.generate_pkcs12(db, dest_dir, cert, key, name)

# Print a blank line and the fingerprint of the cert that ClientAuthServer.cpp
# should be modified with.
print
CertUtils.print_cert_info(cert)
print ('You now MUST update the fingerprint in ClientAuthServer.cpp to match ' +
       'the fingerprint printed above.')

# Remove unnecessary .der file
os.remove(dest_dir + "/" + name + ".der")
開發者ID:AtulKumar2,項目名稱:gecko-dev,代碼行數:31,代碼來源:generate.py

示例2: generate_and_maybe_import_cert

# 需要導入模塊: import CertUtils [as 別名]
# 或者: from CertUtils import print_cert_info [as 別名]
        adequate_key_size,
        generate_ev)

    # Generate chain with an end entity cert that has an inadequate size
    generate_and_maybe_import_cert(
        key_type,
        'ee',
        intOK_nick,
        ee_ext_text,
        intOK_key,
        intOK_cert,
        inadequate_key_size,
        generate_ev)

# Create a NSS DB for use by the OCSP responder.
CertUtils.init_nss_db(srcdir)

# TODO(bug 636807): SECKEY_PublicKeyStrengthInBits() rounds up the number of
# bits to the next multiple of 8 - therefore the highest key size less than 1024
# that can be tested is 1016, less than 2048 is 2040 and so on.
generate_certs('rsa', '1016', '1024', False)
generate_certs('rsa', '2040', '2048', True)

# Print a blank line and the information needed to enable EV for any roots
# generated by this script.
print
for cert_filename in generated_ev_root_filenames:
    CertUtils.print_cert_info(cert_filename)
print ('You now MUST update the compiled test EV root information to match ' +
       'the EV root information printed above.')
開發者ID:ashishrana7,項目名稱:firefox,代碼行數:32,代碼來源:generate.py


注:本文中的CertUtils.print_cert_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。