How to replace deprecated functin call CheckApplicationInstanceCertificate() #3008
Replies: 14 comments 2 replies
-
@PhilJollans You just have to remove the second parameter, like this:
|
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the fast reply. await application.CheckApplicationInstanceCertificates(false); with a letter 's' on the end of the function name. 😃 |
Beta Was this translation helpful? Give feedback.
-
This does not seem to be the exact same behavior. When one needs to specify static Task<bool> CheckCertificates(ApplicationInstance applicationInstance) =>
applicationInstance.CheckApplicationInstanceCertificates(
silent: false, lifeTimeInMonths: LifeTimeInMonths); then the app, which previously worked fine fails with |
Beta Was this translation helpful? Give feedback.
-
I can see the old obsolete method now simply forward to this: [Obsolete("This method is obsolete since an application now supports different minKey sizes depending on certificate type")]
public async Task<bool> CheckApplicationInstanceCertificate(
bool silent,
ushort minimumKeySize,
ushort lifeTimeInMonths,
CancellationToken ct = default)
{
return await CheckApplicationInstanceCertificates(silent, lifeTimeInMonths, ct).ConfigureAwait(false);
} so it appears the new version of the library breaks behavior causing what previusly worked to no longer work, why is that? How can this be fixed? And how does one avoid this breaking usage in the wild? I have confirmed reverting to old library version makes the app/opc ua server work again. |
Beta Was this translation helpful? Give feedback.
-
@nietras i will take a look, can you share the configuration File you are using? |
Beta Was this translation helpful? Give feedback.
-
@romanett after some debugging I found out two of the SecurityPolicy's will fail after the update, removing those then allows the server to start, so the relevant section in the config now looks like. Seems like empty security policy uri now no longer is supported or something (silent breaking change). <SecurityPolicies>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>None_1</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#None</SecurityPolicyUri>
</ServerSecurityPolicy>
<!--<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri></SecurityPolicyUri>
</ServerSecurityPolicy>-->
<!--<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri></SecurityPolicyUri>
</ServerSecurityPolicy>-->
</SecurityPolicies> |
Beta Was this translation helpful? Give feedback.
-
@nietras thanks for the insights |
Beta Was this translation helpful? Give feedback.
-
@nietras not shure about this. Exactly these policies are defined in the reference server and work correctly with the current master. I tested with exactly your polices and also different application certificate configurations and all work. Please provide some more insights (Server logs & stacktrace) or alternatively a test project |
Beta Was this translation helpful? Give feedback.
-
Hmm, perhaps it depends on what certificates are already on the machine, I don't know. I have attached the a full |
Beta Was this translation helpful? Give feedback.
-
Regarding stack trace this simply points to occurring on: await applicationInstance.Start(server); that is:
PS: I have no idea how to get a log file, I have tried a lot but cannot get it to output a file e.g. via Config.xml or similar. Including setting a full absolute path, setting 519 as trace mask etc. |
Beta Was this translation helpful? Give feedback.
-
there is also another thing that no longer goes from version Error: /// <summary>
/// Creates the objects used to validate the user identity tokens supported by the server.
/// </summary>
private void CreateUserIdentityValidators(ApplicationConfiguration configuration)
{
for (int ii = 0; ii < configuration.ServerConfiguration.UserTokenPolicies.Count; ii++)
{
UserTokenPolicy policy = configuration.ServerConfiguration.UserTokenPolicies[ii];
// create a validator for a certificate token policy.
if (policy.TokenType == UserTokenType.Certificate)
{
// check if user certificate trust lists are specified in configuration.
if (configuration.SecurityConfiguration.TrustedUserCertificates is not null && configuration.SecurityConfiguration.UserIssuerCertificates is not null)
{
CertificateValidator certificateValidator = new();
certificateValidator.Update(configuration.SecurityConfiguration).Wait();
certificateValidator.Update(configuration.SecurityConfiguration.UserIssuerCertificates, configuration.SecurityConfiguration.TrustedUserCertificates, configuration.SecurityConfiguration.RejectedCertificateStore);
// set custom validator for user certificates.
m_userCertificateValidator = certificateValidator.GetChannelValidator();
}
}
}
} EDIT 1: Apparently, UpdateAsync takes SecurityConfiguration instead of ApplicationConfiguration as input
|
Beta Was this translation helpful? Give feedback.
-
@zN3utr4l thanks for the hint. We renamed only one of the Method overloads to UpdateAsync, in the next update both overloads will be called UpdateAsync to be consistent |
Beta Was this translation helpful? Give feedback.
-
@nietras please take a look at the reference Server to see how the logging is set up: https://github.com/romanett/UA-.NETStandard/tree/master/Applications/ConsoleReferenceServer The issue occurs if no application certificate is found: |
Beta Was this translation helpful? Give feedback.
-
@nietras I have no issue running your configuration file with the reference server, maybe an Issue with how you manage Server Startup |
Beta Was this translation helpful? Give feedback.
-
I have a OPC server implemented with the UI-.NETStandard. I have updated to the most recent version of the NuGet package
OPCFoundation.NetStandard.Opc.Ua
and now I am getting a warning on the statement:My knowledge about the UI-.NETStandard library is fairly minimal and I can't figure out how I should fix this error. I would be grateful for a some advice, or just a pointer to where I can find suitable documentation.
By the way, this server is only used to simulate another system for the purpose of software tests. In this scenario we are not using any security at all.
Thanks in advance
Phil
Beta Was this translation helpful? Give feedback.
All reactions