Main Content

Simulink.ModelReference.ProtectedModel.setPasswordForCertificate

Provide password for digital certificate

Since R2020a

Description

example

Simulink.ModelReference.ProtectedModel.setPasswordForCertificate(certificateFile,password) provides the required password to access the certificate file to digitally sign a protected model.

Examples

collapse all

Protect a model, and then digitally sign it by using a password protected certificate.

Open and protect the model that you want to sign. For this example, protect the model sldemo_mdlref_counter.

openExample('sldemo_mdlref_counter');
Simulink.ModelReference.protect('sldemo_mdlref_counter');

Locate the certificate file that you want to use to sign the protected model. Enter the password for the certificate.

Simulink.ModelReference.ProtectedModel.setPasswordForCertificate('certificate_file.pfx','password');

Sign the protected model by using the certificate file.

Simulink.ProtectedModel.sign('sldemo_mdlref_counter.slxp','certificate_file.pfx');

Input Arguments

collapse all

Certificate file to use for signing the protected model, specified as a character vector or string scalar. The certificate must be a PKCS #12 file with the extension .pfx or .p12.

Example: 'my_cert.pfx'

Example: 'InstitutionCertificate.p12'

Password, specified as a string or character vector. If the certificate is encrypted for code generation, the password is required.

Version History

Introduced in R2020a