RegifySdk first steps

From regify WIKI
Jump to navigation Jump to search

General information

You need a valid regify user account in order to send regimails. If you want to send commercially (eg hospital etc), it must be a regimail professional account. We suggest to use your own regify account for testing purposes and later use another one created just for this purpose.

Note: A regimail professional user is able to register up to 500 transactions a month. For more, please contact the regify provider administrators. If your account is regimail private (for private consumers only), the limit is 10 messages/month and it is not allowed for commercial usage and cannot get increased.

Using regifycmd

Get needed environment data

In order to allow you encryption with regimail, you need to get some environment data first. It consists of a "url" and some specific "provider data" value. This is only needed once as long as you don't use another regify service provider.

You get the data by calling regifycmd like this (example values)

./regifycmd -C -e '<myMailaddress>' -p '<myPassword>' -o 'config.json'
Code: 0 - OK: Configuration successfully saved.

The configuration of the regify service provider this user is registered at is now in the config.json file.

Extract environment data

You can get the two needed values "providerUrl" and "ProviderData" from the json file manually or let grep command help you a little bit:

grep -oP '"providerData":"\K[^"]+' config.json
3 6C65A72D6A39CC9498715571734994566C36D62136FA13C49DD08023CD6CD0D140B131B1E2F2B32D6ED2213614F515B3194A2B3D35FC881837E2DE8D4018AF95FE2ADD02F76846AE78F82862BD1C07CCA4B77D6192F2DADCDD80590832019E3B836035889B84AF708DAE7E23F3FD5EEE2E331661C15295E1CB49C06DB852A1EC1ED258D485555A2C29F91097C1A58897122A18D951C8722D4815ED136951C484A54BC3589CEEC2DD644086D97AE04573D69ADD2346BA91E010CFCE2E388E176A4870206149E02ADC5DF48EE98D9C289282FEF35414534A917015D7C595E3FEA26508F98261F613E596CDAE33135023BAAF6C3BD2D5167CFA92C92CD4258C8922 3082010B02820100B2B0930BB423229A3CDE2A090B9224A3BEF0054FB3DE6BECD8CD7F8900EE71BDB2F563E143E15D53C43F64B58CA69724663B4FBF5FC9944EB0EA0790B77B8AE3ED8707C9669839F5DC09291BF895F81AFEA8A42E96AC0C777FC287793A95360687125C04DAF6408ADDF9498E400D00586A5AE617BD1F0DAE354DD2EA4557951A9B15E47D52FC13AC76393D9A3162A1FC0FD5BCE3D29B6B883794AD83F2008BE71C3ADC75C73EA342562CE64DF465A514F72F62647495B45A3BEE14B8D28DCAA4339EC53DFDD1221A8643E2EF60E20E62C540FBE314C24DA79DC2D62AA9640C82F27147E13BFDB5118DF7C05E23610FE55EFF18AD1C5E632342CE7F2E804F34FF02820003010001
grep -oP '"providerUrl":"\K[^"]+' config.json

So you have the two needed environment information. You may want to save this in your source code as constants or in a database or a local file etc.

IMPORTANT: Please note that you do not need to do this all the time! As long as you're on the same regify provider, it is the same data and you must re-use it. Do not request it again and again for every message!

Create regimail file

Now, for creation of regimails, you can do like this:

Create a folder for message composing (body and attachments are taken from there):

mkdir newMessage

Create some body message (here, a simple text body. Use body.html to use HTML body):

vi newMessage/body.asc

You might also add some files as attachments to this folder.

Finally, create your encrypted RGF file like this:

regifycmd -M -o 'outRegimail.rgf' -i 'InputDir' -u 'Username' \ -p 'Password' [-f 'IdentityFile'] -s 'Subject' -d 3 -e '' \ -r 'recip1;recip2' -n 'sendername' -U 'regifyURL' -k '0 94F47D...'

With adapted values from above it looks like this:

./regifycmd -M -o 'regimail_#id.rgf' -i 'newMessage' -u '<myMailaddress>' -p '<myPassword>' \
-s 'Subject' -d 3 -e '<myMailaddress>' -r '<recipientMailaddress1>;<recipientMailaddress2>' \
-n '<myName>' -U '' \
-k '3 6C65A72D6A39CC9498715571734994566C36D62136FA13C49DD08023CD6CD0D140B131B1E2F2B32D6ED2213614F515B3194A2B3D35FC881837E2DE8D4018AF95FE2ADD02F76846AE78F82862BD1C07CCA4B77D6192F2DADCDD80590832019E3B836035889B84AF708DAE7E23F3FD5EEE2E331661C15295E1CB49C06DB852A1EC1ED258D485555A2C29F91097C1A58897122A18D951C8722D4815ED136951C484A54BC3589CEEC2DD644086D97AE04573D69ADD2346BA91E010CFCE2E388E176A4870206149E02ADC5DF48EE98D9C289282FEF35414534A917015D7C595E3FEA26508F98261F613E596CDAE33135023BAAF6C3BD2D5167CFA92C92CD4258C8922 3082010B02820100B2B0930BB423229A3CDE2A090B9224A3BEF0054FB3DE6BECD8CD7F8900EE71BDB2F563E143E15D53C43F64B58CA69724663B4FBF5FC9944EB0EA0790B77B8AE3ED8707C9669839F5DC09291BF895F81AFEA8A42E96AC0C777FC287793A95360687125C04DAF6408ADDF9498E400D00586A5AE617BD1F0DAE354DD2EA4557951A9B15E47D52FC13AC76393D9A3162A1FC0FD5BCE3D29B6B883794AD83F2008BE71C3ADC75C73EA342562CE64DF465A514F72F62647495B45A3BEE14B8D28DCAA4339EC53DFDD1221A8643E2EF60E20E62C540FBE314C24DA79DC2D62AA9640C82F27147E13BFDB5118DF7C05E23610FE55EFF18AD1C5E632342CE7F2E804F34FF02820003010001'

The created file regimail_nnnnnnnn.rgf is the resulting regify file now. You can send or transfer it with every method you like (mail, FTP, file copy, USB stick etc).

Please note that an IdentityFile (-f) is optional and not needed as long as you do not plan to use explicit sender authentication.


Finally, you may want to cleanup your message composition folder like this:

rm -rf newMessage/