OPC Studio User's Guide and Reference
GetSerialNumberByteArray Method (PkiCertificate)



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Security.Cryptography.PkiCertificates Namespace > PkiCertificate Class : GetSerialNumberByteArray Method
Same as System.Security.Cryptography.X509Certificates.X509Certificate.GetSerialNumber. Returns the serial number of the PKI certificate as an array of bytes in little-endian order.
Syntax
'Declaration
 
<BrowsableAttribute(False)>
<EditorBrowsableAttribute(EditorBrowsableState.Advanced)>
Public Function GetSerialNumberByteArray() As Byte()
'Usage
 
Dim instance As PkiCertificate
Dim value() As Byte
 
value = instance.GetSerialNumberByteArray()
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public byte[] GetSerialNumberByteArray()
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public:
array<byte>^ GetSerialNumberByteArray(); 

Return Value

The serial number of the PKI certificate as an array of bytes in little-endian order.

This method never returns null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

An error occurred during a cryptographic operation.

This is an operation error that depends on factors external to your program, and thus cannot be always avoided. Your code must handle it appropriately.

Remarks

This method has been introduced as an alternative way to achieve the functionality of System.Security.Cryptography.X509Certificates.X509Certificate.GetSerialNumber for some COM consumers (such as Microsoft C++ native COM support #import), where the automatically generated getter function for the System.Security.Cryptography.X509Certificates.X509Certificate2.SerialNumber property becomes GetSerialNumber, causing a conflict.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also