本文整理汇总了C++中Extensions::replace方法的典型用法代码示例。如果您正苦于以下问题:C++ Extensions::replace方法的具体用法?C++ Extensions::replace怎么用?C++ Extensions::replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extensions
的用法示例。
在下文中一共展示了Extensions::replace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Basic_Constraints
/*
* Sign a PKCS #10 certificate request
*/
X509_Certificate X509_CA::sign_request(const PKCS10_Request& req,
RandomNumberGenerator& rng,
const X509_Time& not_before,
const X509_Time& not_after)
{
Key_Constraints constraints;
if(req.is_CA())
{
constraints = Key_Constraints(KEY_CERT_SIGN | CRL_SIGN);
}
else
{
std::unique_ptr<Public_Key> key(req.subject_public_key());
verify_cert_constraints_valid_for_key_type(*key, req.constraints());
constraints = req.constraints();
}
Extensions extensions = req.extensions();
extensions.replace(
new Cert_Extension::Basic_Constraints(req.is_CA(), req.path_limit()),
true);
if(constraints != NO_CONSTRAINTS)
{
extensions.replace(new Cert_Extension::Key_Usage(constraints), true);
}
extensions.replace(new Cert_Extension::Authority_Key_ID(m_cert.subject_key_id()));
extensions.replace(new Cert_Extension::Subject_Key_ID(req.raw_public_key()));
extensions.replace(
new Cert_Extension::Subject_Alternative_Name(req.subject_alt_name()));
extensions.replace(
new Cert_Extension::Extended_Key_Usage(req.ex_constraints()));
return make_cert(m_signer, rng, m_ca_sig_algo,
req.raw_public_key(),
not_before, not_after,
m_cert.subject_dn(), req.subject_dn(),
extensions);
}