Platforms to show: All Mac Windows Linux Cross-Platform

Back to X509MBS class.

X509MBS.CheckCertificates(rootCertificates() as X509MBS, certificate as X509MBS, intermediates() as X509MBS = nil, Flags as Integer = 0) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 22.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Validates certificate agains root certificates and may use intermediates for it.

Returns true if valid or false if not.

This function attempts to discover and validate a certificate chain based on parameters in context. The verification context, is constructed using given root certificates.

Flags: Optional flags for X509_verify_cert. Please check OpenSSL documentation.

See also:

X509MBS.CheckCertificates(rootCertificates() as X509MBS, certificate as X509MBS, intermediates() as X509MBS, Flags as Integer, byref ErrorCode as Integer, byref ErrorMessage as String) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Validates certificate agains root certificates and may use intermediates for it.

Returns true if valid or false if not.

This function attempts to discover and validate a certificate chain based on parameters in context. The verification context, is constructed using given root certificates.

Flags: Optional flags for X509_verify_cert. Please check OpenSSL documentation.

ErrorCode and ErrorMessage report back any error from X509_verify_cert function.

See also:

X509MBS.Open(Data as MemoryBlock) as X509MBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Opens a X509 PEM file.

Line endings must be LF, not CR.

Version 24.3 accepts binary certificate data, too.

See also:

X509MBS.Open(Data as String) as X509MBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Opens a X509 PEM file.

Please read file via binarystream and pass here as string.
Line endings must be LF, not CR.

Version 24.3 accepts binary certificate data, too.

See also:

X509MBS.ReadFromPkcs12(Data as String, Pass as String, byref PKey as PKeyMBS, byref Cert as X509MBS, byref certs() as X509MBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads certificate and private key from a PKCS12 file.
Example
Var f as FolderItem = FindFile("test.p12")
Var b as BinaryStream = BinaryStream.Open(f)
Var s as string = b.Read(b.Length)
Var c as X509MBS
Var p as PKeyMBS
Var others() as X509MBS

if X509MBS.ReadFromPkcs12(s, "HelloWorld", p, c, others) then
MsgBox c.Name
end if

Data is the content of the PKCS12 file.
Returns true on success or false on failure.

Some examples using this method:

X509MBS.ReadFromPkcs7(Data as String, Pass as String, byref certs() as X509MBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 21.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads certificates from PKCS#7 data.
Example
Var contents as string // PKCS#7 file data
Var certs() As X509MBS
If X509MBS.ReadFromPkcs7(contents, "", certs) Then

Var x As X509MBS = certs(0)
If x <> Nil Then
// show it
TextArea1.Text= x.Description
end if
End If

Returns true on success.
Only for PKCS#7 data containing signatures.

X509MBS.WriteToPkcs12(friendlyName as String, Pass as String, PKey as PKeyMBS, Cert as X509MBS, certs() as X509MBS) as String   New in 26.4

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Encryption and Hash MBS Encryption Plugin 26.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a PKCS#12 file and returns it as string.
Example
Var file As FolderItem = SpecialFolder.Desktop.Child("signer.p12")
Var bstream As BinaryStream = BinaryStream.Open(file)
Var bdata As String = bstream.Read(bstream.Length)
Var cert As X509MBS
Var pKey As PKeyMBS
Var others() As X509MBS
var password as string = "12345"

If X509MBS.ReadFromPkcs12(bdata, password, pKey, cert, others) Then

var output as string = X509MBS.WriteToPkcs12("Test Certificate", password, pKey, cert, others)
Var newFile As FolderItem = SpecialFolder.Desktop.Child("other.p12")
bstream = BinaryStream.Create(newFile, True)
bstream.Write output
bstream.Close

Break // check result
End If

Returns empty string if something fails. Raises out of memory exception in case of allocation failing.

The items on this page are in the following plugins: MBS Encryption Plugin.


The biggest plugin in space...