Gateway API

Assuming you already possess a download token, you can obtain a link to the file you need using the following REST call:

Method

GET

Host

oesis.metadefender.com

URL

/api/file-retrieval/file-link/<file name>

Header

OPSWAT-Token:<download token>

A typical response from the server would be a JSON string similar to this:

{
"code":200,
"Result":
{
"link":"https://www.samplehost.com/updates/data/filename_timestamp.dat",
"unencrypted_link":"https://www.samplehost.com/updates/data/filename_timestamp.dat",
"aes_key":"AESKEYSTRING",
"timestamp":"1478872811",
"signature":"EabLxwZvpqxMMqvIEOqaHFu6HF8=",
"unencrypted_signature":"6mubuCyKyMyDfxRVkz84LozSJwg=",
"file":"vmod.dat",
"expiration":"1479132011"
}
}

“link”: encrypted file, you can use the AES key from the JSON to decrypt it.
“unencrypted_link”: non encrypted file.

You have the option to register an RSA 2048 bit public key to use with the gateway. The gateway will then encrypt all results.

To create a new public key or change an existing one:

Method

POST

Host

oesis.metadefender.com

URL

/api/file-retrieval/update-key

Header

OPSWAT-Token:<download token>

Body

<RSA 2048 bit public key>

Note that a download token is sufficient to perform all REST calls. Setting up an RSA key is NOT a requirement to use the Content Delivery system. Nor is it in place to protect the file data. The feature exists so that you can be sure that you obtain the file from OPSWAT’s authorized gateway servers.

Be sure to use an RSA 2048 bit public key which is in PEM format. You can use the following commands to generate a new key:

$ openssl genrsa -out private.pem 2048
$ openssl rsa -in private.pem -outform PEM -pubout -out public.pem

The public key is the entire string between “-----BEGIN PUBLIC KEY-----” and “-----END PUBLIC KEY-----” in the public.pem file.

You can also provide us the public key during your account setup and we will register it with the gateway for you.