IPWorks EDI 2020 macOS Edition

Questions / Feedback?

OFTPConnection Type

A currently connected client.

Remarks

This type describes the connection of a client which is currently connected to the class. You may use the different fields of this type to manage the connection.

Fields

compress
Bool

Whether or not compression is used on the outgoing or incoming file.

When sending files to the client, if Compress is true the file will be compressed.

When receiving files, query this property to determine whether the file received from the client was compressed or not.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

connected
Bool

This property is used to disconnect individual connections and/or show their status.

The Connected property may be set to false to close the connection.

Connected also shows the status of a particular connection (connected/disconnected).

How and when the connection is closed is controlled by the Linger property. Please refer to its description for more information.

connectionId
String

This property contains an identifier generated by the class to identify each connection. This identifier is unique to this connection.

downloadDirectory
String

The directory to which files will be saved.

This specifies the directory where files received by the server will be saved. This must be set before the client begins sending files. Set this in the Connected, AcceptConnection, or ConnectionRequest events, for instance:

oftpserver1.SetOFTPConnectionDownloadDirectory(123456789, "C:\\Downloads");

encryptionAlgorithm
OftpserverEncryptionAlgorithms

The encryption algorithm used when sending files to the client.

In order to use encryption, you must set the VirtualFileSecurityLevel property. The supported algorithms for encryption are:

0 (encra3DES - default) DES (Triple Data Encryption Standard).
1 (encraAES) AES (Advanced Encryption Standard with key length of 128).

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

localAddress
String

This property shows the IP address of the interface through which the connection is passing.

LocalAddress is important for multi-homed hosts where it can be used to find which particular network interface an individual connection is going through.

maxRecordSize
Int32

This value determines the maximum length for a record in the outgoing virtual file. When VirtualFileFormat has been set to ffUnstructured or ffText, this value must be zero. When ffFixed or ffVariable, this must be set to a value greater than 0, containing the maximum line length of the outgoing file.

readyToSend
Bool

Specifies whether or not the server can send to the client.

When the client passes control to the server, this property will be true. Additionally the ReadyToSend event will fire at this time. This must be true before sending files to the client.

recipientCertStoreB
Data

The name of the certificate store for the recipient certificate.

The RecipientCertStoreType property specifies the type of the certificate store specified by RecipientCertStore. If the store is password protected, specify the password in RecipientCertStorePassword.

RecipientCertStore is used in conjunction with the RecipientCertSubject property in order to specify client certificates. If RecipientCertStore has a value, and RecipientCertSubject is set, a search for a certificate is initiated. Please refer to the RecipientCertSubject property for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot certificates.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

recipientCertStore
String

The name of the certificate store for the recipient certificate.

The RecipientCertStoreType property specifies the type of the certificate store specified by RecipientCertStore. If the store is password protected, specify the password in RecipientCertStorePassword.

RecipientCertStore is used in conjunction with the RecipientCertSubject property in order to specify client certificates. If RecipientCertStore has a value, and RecipientCertSubject is set, a search for a certificate is initiated. Please refer to the RecipientCertSubject property for details.

Designations of certificate stores are platform-dependent.

The following are designations of the most common User and Machine certificate stores in Windows:

MYA certificate store holding personal certificates with their associated private keys.
CACertifying authority certificates.
ROOTRoot certificates.

When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

recipientCertStorePassword
String

If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

recipientCertStoreType
CertStoreTypes

The type of certificate store for this certificate.

The class supports both public and private keys in a variety of formats. When the cstAuto value is used the class will automatically determine the type. This property can take one of the following values:

0 (cstUser - default)For Windows, this specifies that the certificate store is a certificate store owned by the current user. Note: this store type is not available in Java.
1 (cstMachine)For Windows, this specifies that the certificate store is a machine store. Note: this store type is not available in Java.
2 (cstPFXFile)The certificate store is the name of a PFX (PKCS12) file containing certificates.
3 (cstPFXBlob)The certificate store is a string (binary or base64-encoded) representing a certificate store in PFX (PKCS12) format.
4 (cstJKSFile)The certificate store is the name of a Java Key Store (JKS) file containing certificates. Note: this store type is only available in Java.
5 (cstJKSBlob)The certificate store is a string (binary or base64-encoded) representing a certificate store in Java Key Store (JKS) format. Note: this store type is only available in Java.
6 (cstPEMKeyFile)The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate.
7 (cstPEMKeyBlob)The certificate store is a string (binary or base64-encoded) that contains a private key and an optional certificate.
8 (cstPublicKeyFile)The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate.
9 (cstPublicKeyBlob)The certificate store is a string (binary or base64-encoded) that contains a PEM- or DER-encoded public key certificate.
10 (cstSSHPublicKeyBlob)The certificate store is a string (binary or base64-encoded) that contains an SSH-style public key.
11 (cstP7BFile)The certificate store is the name of a PKCS7 file containing certificates.
12 (cstP7BBlob)The certificate store is a string (binary) representing a certificate store in PKCS7 format.
13 (cstSSHPublicKeyFile)The certificate store is the name of a file that contains an SSH-style public key.
14 (cstPPKFile)The certificate store is the name of a file that contains a PPK (PuTTY Private Key).
15 (cstPPKBlob)The certificate store is a string (binary) that contains a PPK (PuTTY Private Key).
16 (cstXMLFile)The certificate store is the name of a file that contains a certificate in XML format.
17 (cstXMLBlob)The certificate store is a string that contains a certificate in XML format.
18 (cstJWKFile)The certificate store is the name of a file that contains a JWK (JSON Web Key).
19 (cstJWKBlob)The certificate store is a string that contains a JWK (JSON Web Key).
20 (cstSecurityKey)The certificate is present on a physical security key accessible via a PKCS11 interface.

To use a security key the necessary data must first be collected using the CertMgr class. The ListStoreCertificates method may be called after setting CertStoreType to cstSecurityKey, CertStorePassword to the PIN, and CertStore to the full path of the PKCS11 dll. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use.

When using a certificate, pass the previously saved security key information as the Store and set StorePassword to the PIN.

Code Example: SSH Authentication with Security Key

certmgr.CertStoreType = CertStoreTypes.cstSecurityKey;
certmgr.OnCertList += (s, e) => {
  secKeyBlob = e.CertEncoded;
};
certmgr.CertStore = @"C:\Program Files\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll";
certmgr.CertStorePassword = "123456"; //PIN
certmgr.ListStoreCertificates();

sftp.SSHCert = new Certificate(CertStoreTypes.cstSecurityKey, secKeyBlob, "123456", "*");
sftp.SSHUser = "test";
sftp.SSHLogon("myhost", 22);

21 (cstBCFKSFile)The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store). Note: this store type is only available in Java and .NET.
22 (cstBCFKSBlob)The certificate store is a string (binary or base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format. Note: this store type is only available in Java and .NET.
99 (cstAuto)The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

recipientCertSubject
String

The subject of the recipient certificate.

This property must be set after all other certificate properites are set. When this property is set, a search is performed in the current certificate store certificate with matching subject.

If a matching certificate is found, the property is set to the full subject of the matching certificate.

If an exact match is not found, the store is searched for subjects containing the value of the property.

If a match is still not found, the property is set to an empty string, and no certificate is selected.

The special value "*" picks a random certificate in the certificate store.

The certificate subject is a comma separated list of distinguished name fields and values. For instance "CN=www.server.com, OU=test, C=US, E=support@nsoftware.com". Common fields and their meanings are displayed below.

FieldMeaning
CNCommon Name. This is commonly a host name like www.server.com.
OOrganization
OUOrganizational Unit
LLocality
SState
CCountry
EEmail Address

If a field value contains a comma it must be quoted.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

remoteHost
String

This property shows the IP address of the remote host through which the connection is coming.

The connection must be valid or an error will be fired.

If the class is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.

remotePort
Int32

This property shows the TCP port on the remote host through which the connection is coming.

The connection must be valid or an error will be fired.

sfidCode
String

The connected client's SFID code.

The SFID code identifies the origin or destination party that is sending or receiving a file, while the SSID code identifies the party that a session is established with. If the SFID and SSID codes do not match, then the party the session is established with is acting as an intermediary, and the party identified by the SFID code is either the origin or final destination.

When acting as an intermediary the component will not perform any security services (i.e. sign, verify, encrypt, decrypt). Security services are to be performed by the origin or destination only. Data should simply be passed along by an intermediary.

signedReceipt
Bool

Indicates whether a signed receipt is requested.

When sending files, if this is set to true a signed receipt will be requested. In that case RecipientCertStoreType, RecipientCertStore, and RecipientCertSubject must be set to specify the public certificate that will be used to verify the signature on the receipt returned by the client after SendFile is called. The class will automatically verify the signature on the returned receipt.

When receiving files, query this property to determine if the client requested a signed receipt. If true, the Certificate property must be set to a certificate with private key in order to sign the receipt that will be returned to the client. The class will sign and deliver the receipt automatically.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

ssidCode
String

The connected client's SSID code.

timeout
Int32

A timeout for the class.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion or an error condition is encountered.

If Timeout is set to a positive value, the class will wait for the operation to complete before returning control.

The class will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the class .

Please note that by default, all timeouts are inactivity timeouts, i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

The default value for Timeout is specified by the DefaultTimeout property.

version
TOFTPVersions

This holds the version of OFTP supported by the client. This value cannot be changed. All communication with the client is performed using the version returned by this property. Possible values are:

0 (oftpVer12) OFTP Version 1.2
1 (oftpVer13) OFTP Version 1.3
2 (oftpVer14) OFTP Version 1.4
3 (oftpVer20) OFTP Version 2.0

virtualFileDate
String

Set this to the date/time stamp for the virtual file before sending. If this is not set when sending a file, the current date/time will be used. This property will accept various date formats, but will return the following format only: "MM/dd/yyyy HH:mm:ss".

Supported date formats:

  • ddd, d MMM yy HH:mm:ss zzz
  • ddd, d MMM yyyy HH:mm:ss zzz
  • d MMM yy HH:mm:ss zzz
  • d MMM yyyy HH:mm:ss zzz
  • dd-MMM-yyyy HH:mm:ss
  • ddd, d MMM yy HH:mm:ss zz
  • ddd, d MMM yyyy HH:mm:ss zz
  • ddd, d MMM yy HH:mm:ss zzz
  • ddd, d MMM yyyy HH:mm:ss zzz
  • ddd, d MMM yy HH:mm:ss z
  • ddd, d MMM yyyy HH:mm:ss z
  • ddd, dd MMM yyyy HH:mm:ss 'GMT'
  • dddd, MMMM dd, yyyy h:mm:ss tt
  • dddd, MMMM dd yyyy h:mm tt
  • yyMMddHHmmssZ
  • yyyyMMddHHmmssZ
  • yyMMddHHmmsszzzz
  • yyyyMMddHHmmsszzzz
  • yyyyMMddHHmmssffff
  • MM/dd/yyyy HH:mm:ss

virtualFileFormat
VirtualFileFormats

The structure of the outgoing or incoming file.

When sending files, set this property to specify the format to apply to outgoing files.

When receiving files, query this property to determine the structure of the file received from the client.

The following values are valid file formats for outgoing virtual files:

0 (Unstructured - default) The outgoing file is binary and has not structure. There are no records in this type of file.
1 (Text) The outgoing file is a text file that consists of lines containing no more than 2048 characters terminated by CRLF. This type contains no records.
2 (Fixed) The outgoing file is in fixed file format, which means all records are of the same length. For fixed files, the class expects the file to be in text format with each line containing the MaxRecordSize characters terminated by a CRLF.
3 (Variable) The outgoing file is a variable file format, meaning all records are of variable length and are no longer than MaxRecordSize. When using this format, the class will parse out each record as a line terminated by CRLF. Thus, this type of file must be a text file, and must contain lines with less than MaxRecordSize characters.

Note: When either VirtualFileSecurityLevel has been set to a value other than slNone or Compress has been set to true, all files become ffUnstructured except ffVariable files.

virtualFileSecurityLevel
VirtualFileSecurityLevels

Specifies security options for the outgoing or incoming file.

When receiving files, query this property to determine the security level of the file received from the client.

When sending files to the client, this property will be used to determine what security options apply to the outgoing file. Possible values are:

0 (slNone - default)The file will not be signed nor encrypted.
1 (slEncrypted)The file will be encrypted using the certificate specified by the RecipientCertSubject. property
2 (slSigned)The file will be signed using the certificate specified by the Certificate property;
3 (slEncryptedAndSigned)The file will be both signed and encrypted.

Note that this is only applicable when Version 2.0 of the protocol is used as indicated by Version.

Constructors

public init()

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 macOS Edition - Version 20.0 [Build 8203]