Class: MASPluginSecurityConfiguration

MASPluginSecurityConfiguration

A class to set MAS Security Configuration for a server based on the trust settings.
MASPluginSecurityConfiguration Constructor
var MASSecurityConfiguration = new MASPlugin.MASSecurityConfiguration();

Methods

addCertificate(certificate)

Set the certificate of the host server
Parameters:
Name Type Description
certificate string The pinned certificate in Base64 string format
Source:

addPublicKeyHash(publicKeyHash)

Set the public keys of the host server
Parameters:
Name Type Description
publicKeyHash string String value in Base64 of the pinned public key hash.
Source:

getSecurityConfiguration() → {Object}

Gets the final MASSecurityConfiguration as a JSON object
Source:
Returns:
MASSecurityConfiguration object
Example output --
{
  host:gw.ca.com:443,
  isPublic:false,
  certificates:[Jcnjd...],
  trustPublicPKI:true
}
Type
Object

setHost(host)

Set the host of the server that you want to connect
Parameters:
Name Type Description
host string Uri object containing the hostname, and port number.
Source:

setPinningMode(pinningMode)

Set the SSL Pinning mode needed.
Parameters:
Name Type Description
pinningMode MASSecuritySSLPinningMode enum value to specify the type of SSL pinning needed. The Certifcates array needs to be set accordingly with the certificates that needs to be pinned. If MASSecuritySSLPinningModeIntermediateCertifcate is chosen, then the certificates array should contain intermediate certificate.
Source:

setPublic(isPublic)

Sets the public/private scope of the server.
Parameters:
Name Type Description
isPublic boolean Boolean value that specifes whether the server is public or not.
Source:

setTrustPublicPKI(trustPublicPKI)

Determines whether to trust Public PKI for the host server.
Parameters:
Name Type Description
trustPublicPKI boolean Boolean value to trust, or not to trust the public PKI. If false, provide either the certificate, or the publicKeyHash.
Source:

Type Definitions

MASSecuritySSLPinningMode

The constant which specifies the SSL pinning mode that can be opted.
Type:
  • Object
Properties:
Name Type Description
MASSecuritySSLPinningModePublicKeyHash number SSL Pinning based on Public Key Hash
MASSecuritySSLPinningModeCertificate number SSL pinning based on Leaf Certificate
MASSecuritySSLPinningModeIntermediateCertificate number SSL pinning based on Intermediate Certificate
Source: