Transfer Token Generation (astokengen)

The astokengen command line tool enables users to generate and decode transfer tokens. Unless you are creating a transfer token for an Ascp 4 session, which requires that you use astokengen with the --full-paths option, Aspera recommends using the Node API tool to work with transfer tokens as it provides more functionality. For instructions see Transfer Token Creation (Node API). The Node API response includes FASP transfer parameters and the token string, whereas astokengen generates only a specific type of token. astokengen is most useful for decoding tokens during application development for debugging purposes.

Syntax and Options

# astokengen [options]
Option (short form) Option (long form) Description
-A --version Print version information.
  --mode=mode Direction of the transfer mode (send | recv)
-p --path=path Source path
  --dest=destination Destination path
-u --user=user Generate the token for this user name. This name is embedded in the token and also used to retrieve further information from aspera.conf (user_value and token_life_seconds).
  --source-prefix=prefix Prepend the given path to each source path.
  --full-paths Store the entire path set in the token.
Note: This option is required when creating tokens for A4 transfers.
  --file-list=filename Specifies a file name that contains a list of sources for a download token. Each line of the file contains a single source and blank lines are ignored. For example:
/monday/first_thing.txt
/monday/next_thing.txt  
/monday/last_thing.txt  
  --file-pair-list=filename Specifies a file name that contains a multiplexed list of source and destination pairs for an upload or download token. Each pair of lines encodes one source and one destination and blank lines are ignored. For example
/monday/first_thing.txt
/archive/monday/texts/first_thing  
/monday/next_thing.txt  
/archive/monday/texts/next_thing  
/monday/last_thing.txt  
/archive/monday/texts/last_thing
-v token   Verify token against user and path parameters.
-t token   Display the contents of the token.
-k passphrase   Passphrase to decrypt token. For use with -t.
-b   Assume user name and paths are encoded in base64.

General Usage Examples

  • Display the contents of the token:
    # astokengen -t token [options] 
  • Authorize uploads to a specific destination:
    # astokengen --mode=send [options] -u user --dest=path [-v token]
     
  • Authorize uploads of one or more files as source/destination pairs to a specific destination:
    # astokengen --mode=send [options] -u user --file-pair-list=filename --dest=destination [-v token] 
     
  • Authorize downloads of one or more files or directories from a specific destination:
    # astokengen --mode=recv [options] -u user -p path [-p path …] [-v token]
     
  • Authorize downloads of files specified in a file list:
    # astokengen --mode=recv [options] -u user --file-list=filename [-v token]
     
  • Authorize downloads of one or more files as source/destination pairs:
    # astokengen --mode=recv [options] -u user --file-pair-list=filename [-v token] 
     

Usage Examples

Description Example
Common upload In a common upload, only the destination is encoded into the token.
# astokengen --user=user --dest=path --mode=send

Source paths and file lists (--path and --file-list) are not allowed and will cause astokengen to fail.

Paired upload The destination is prepended to the destinations in the paired list file and they are encoded into the token. The destinations are in the odd numbered lines of the file (1, 3, 5, 7, and so on).
# astokengen --user=user --dest=path --file-pair-list=filename --mode=send  

Source paths and file lists (--path and --file-list) are not allowed and will cause astokengen to fail.

Common download The specified paths are encoded into the token.
# astokengen --user=user --path=filepath1 --path=filepath2 --mode=recv  
# astokengen --user=user --file-list=filename --mode=recv

In this case, --dest and --file-pair-list are illegal.

Paired download The source files from the file pair list are encoded in the token. The sources are in the even numbered lines of the file (0, 2, 4, 6, 8, etc.).
# astokengen --user=user --file-pair-list=filename --mode=recv  

In this case, --dest, --path and --file-list are illegal.