IServiceWriter.WriteString (METH) ¶ METHOD WriteString : UDINT InOut: Scope Name Type Return WriteString UDINT Input str STRING(255)
CryptoKeyAgreement (FUN) ¶ FUNCTION CryptoKeyAgreement : RTS_IEC_RESULT This function can be used to run asymmetric key agreement protocols like Diffie-Hellman (DH) or elliptic curve Diffie-Hellman (ECDH). These procols can be used to agree on secret keys via an insecure channel. The algorithm can not guarantee authenticity of the communication partner. Therefore, a man in the middle attack can not be detected or prevented during execution of the protocol. The strength of the new key depends on the chosen algorithm. It is recommended to derive a session key from this secret key. InOut: Scope Name Type Comment Return CryptoKeyAgreement RTS_IEC_RESULT Operation result ERR_OK: Key agreement was successful. ERR_INVALID_STATE: The component is not in a valid state to do this operation. RTS_INVALID_HANDLE: The hAlgo was not of type RTSCRYPTOTYPE_KEYAGREEMENT. ERR_PARAMETER: The given keys where invalid or pSharedSecret was NULL. ERR_SIZE_MISMATCH: The given bytestring is too small. ERR_FAILED: The operation failed of some internal error. ERR_NOT_SUPPORTED: The given algorithm or key does not support this operation. Input hAlgo RTS_IEC_HANDLE Handle of the used algorithm. Should be one of the RTSCRYPTOTYPE_KEYAGREEMENT algorithms. privateKey RtsCryptoKey The local private key to run the operation. peerPublicKey RtsCryptoKey The public key of the communication partner. pSharedSecret POINTER TO RtsByteString The calculated shared secret key.
CryptoLoadPrivateKey (FUN) ¶ FUNCTION CryptoLoadPrivateKey : RTS_IEC_RESULT This function can be used to load a private key from the components internal data store. InOut: Scope Name Type Comment Return CryptoLoadPrivateKey RTS_IEC_RESULT Result of the operation Input keyIdentifier RtsByteString The identifier of the key got from CryptoStorePrivateKey. pKey POINTER TO RtsCryptoKey The private key retrieved from the internal storage.
CryptoSignatureGenerate (FUN) ¶ FUNCTION CryptoSignatureGenerate : RTS_IEC_RESULT Sign the data using a specific message digest and the private key. InOut: Scope Name Type Comment Return CryptoSignatureGenerate RTS_IEC_RESULT Result of the operation. Input hAlgo RTS_IEC_HANDLE Handle to the algorithm. pData POINTER TO RtsByteString Data to be signed. privateKey RtsCryptoKey Key to be used signing. Has to be a private key. pSignature POINTER TO RtsByteString Calculated signature of the data.
CryptoSignatureVerify (FUN) ¶ FUNCTION CryptoSignatureVerify : RTS_IEC_RESULT Verify a recieved signature InOut: Scope Name Type Comment Return CryptoSignatureVerify RTS_IEC_RESULT unction returns ERR_OK if the signature is valid. Input hAlgo RTS_IEC_HANDLE Handle to the algorithm. pData POINTER TO RtsByteString Data to verify. publicKey RtsCryptoKey Public key of the sender. pSignature POINTER TO RtsByteString Received signature.
CryptoStorePrivateKey (FUN) ¶ FUNCTION CryptoStorePrivateKey : RTS_IEC_RESULT This function can be used to store a private key that was imported or generated within the components internal data store. InOut: Scope Name Type Comment Return CryptoStorePrivateKey RTS_IEC_RESULT Result of the operation Input key RtsCryptoKey The private key to be stored. pKeyIdentifier POINTER TO RtsByteString A bytestring where the key identifier is stored. This identifier can be used to access the key later. The identifier does not contain any sensitive data.
Functions ¶ CryptoGenerateRandomNumber (Function) CryptoGetAlgorithmById (Function) CryptoGetFirstAlgorithm (Function) CryptoGetNextAlgorithm (Function) CryptoRtsByteStringExit (Function) CryptoRtsByteStringInit (Function) CryptoRtsByteStringInit2 (Function)
CryptoGenerateRandomNumber (FUN) ¶ FUNCTION CryptoGenerateRandomNumber : RTS_IEC_RESULT Generate a number of cryptographic strong bytes. InOut: Scope Name Type Comment Return CryptoGenerateRandomNumber RTS_IEC_RESULT Function returns ERR_OK if the bytes could be generated Input ui32NumOfRandomBytes UDINT Number of bytes needed. pRandom POINTER TO RtsByteString Buffer to store the bytes.
CryptoGetAlgorithmById (FUN) ¶ FUNCTION CryptoGetAlgorithmById : RTS_IEC_HANDLE Get a handle to the algorithm using a specific ID InOut: Scope Name Type Comment Return CryptoGetAlgorithmById RTS_IEC_HANDLE Handle to the crypto algorithm Input ui32CryptoID RtsCryptoID ID of the algorthm pResult POINTER TO RTS_IEC_RESULT Result of the operation. Can be NULL.
CryptoGetFirstAlgorithm (FUN) ¶ FUNCTION CryptoGetFirstAlgorithm : RTS_IEC_HANDLE Get the first algorthm matching the type given. Use this with the GetNext function to iterate over algorthmes of a specific type. InOut: Scope Name Type Comment Return CryptoGetFirstAlgorithm RTS_IEC_HANDLE Handle to the crypto algorithm Input ui32CryptoType RtsCryptoType Type of the algorithm. See: Crypto Types pszName POINTER TO STRING Name of the algorthm. Can be NULL. i32MaxNameLen DINT Maximum length of the name buffer pui32CryptoID POINTER TO RtsCryptoID ID of the algorithm. pResult POINTER TO RTS_IEC_RESULT Result of the operation. Can be NULL.