Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://hilch.github.io/BrSecurity/
Security Functions for B&R Automation Studio
https://hilch.github.io/BrSecurity/
Last synced: 3 months ago
JSON representation
Security Functions for B&R Automation Studio
- Host: GitHub
- URL: https://hilch.github.io/BrSecurity/
- Owner: hilch
- License: other
- Created: 2020-01-02T07:55:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T06:08:08.000Z (9 months ago)
- Last Synced: 2024-05-23T07:25:52.005Z (8 months ago)
- Language: Standard ML
- Size: 136 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-B-R - BrSecurity - Automation Studio Lib with Security functions (Password/Encrypt/Decrypt) (Infrastructure / Security)
README
[![License](https://img.shields.io/badge/License-BSD%204--Clause-blue.svg)](https://opensource.org/licenses/BSD-4-Clause) [![Made For B&R](https://github.com/hilch/BandR-badges/blob/main/Made-For-BrAutomation.svg)](https://www.br-automation.com)
# BrSecurity
Security Functions for B&R Automation Studio.Download the Automation Studio Library [here](https://github.com/hilch/BrSecurity/releases)
---
## Password Hashing### SecGenPwdHash
implements [bcrypt](https://en.wikipedia.org/wiki/Bcrypt) password hashing (origin: Open BSD).
The maximum password length is limited to 56 characters.You can check the hash online at [https://bcrypt-generator.com](https://bcrypt-generator.com/) or with [Bcrypt.cpp](https://github.com/hilch/Bcrypt.cpp) in your own program.
### SecValidatePwd
validates user's password against stored hash
```
PROGRAM _CYCLICIF( generate_hash )THEN
result_password_hash := SecGenPwdHash( password, 10, password_hash );
password := ''; (* never store password directly !! *)
generate_hash := FALSE;
END_IFpassword_is_valid := SecValidatePwd( password, password_hash );
END_PROGRAM
```## Data Encryption / Decryption
### SecBlfInit
implements [Blowfish]() data encryption (origin: Open BSD).
Prepares and stores the Blowfish context with the given key.
Use 'ctx' output for SecBlfEncrypt() and SecBlfDecrypt.### SecBlfEncrypt
Encrypts data pointed to by 'data' with length 'data_len'### SecBlfDecrypt
Decrypt data pointed to by 'data' with length 'data_len'You can check the data encryption online at [http://sladex.org/blowfish.js/](http://sladex.org/blowfish.js/)
```
PROGRAM _INIT
brsstrcpy( ADR(data), ADR('Lorem ipsum dolor sit amet, consetetur sadipscing elitr') );
SecBlfInit_0( key := 'top_secret' );
END_PROGRAMPROGRAM _CYCLIC
IF( encode ) THEN
encode := FALSE;
SecBlfEncrypt( SecBlfInit_0.ctx, ADR(data), brsstrlen(ADR(data)) );
END_IF
IF( decode ) THEN
decode := FALSE;
SecBlfDecrypt( SecBlfInit_0.ctx, ADR(data), brsstrlen(ADR(data)) );
END_IF
END_PROGRAM
```---
## License
to comply with the copyright requirements, the library writes to the logbook the first time functions are called.