Upload, download, list and delete encrypted files on Aliyun OSS. Files are compressed using zlib, encrypted using aes-256-ofb.
go get -v -u github.com/caiguanhao/ossenc
By default, remote file deletion function (the -D option) is not included, to
enable it, you must build with delete
tag:
go get -v -u -tags delete github.com/caiguanhao/ossenc
Usage of ossenc:
-C create (update if exists) config file and exit
-D delete remote files
-F do not format remote file name, ignore FileNameFormat config
-O just like -o but use remote file name
-P print openssl decryption command after upload
-c string
location of the config file (default "~/.ossenc.go")
-f string
file name format, overrides FileNameFormat config
-l list directory
-n dry-run, do not upload or download any file
-o string
download remote file to local file, use - for stdout
-p do not show progress
You must enter Aliyun OSS API key ID and secret string in the config file,
default location of the config file is ~/.ossenc.go
.
# create config
ossenc -C
The 256-bit encryption key for aes-256-ofb.
Format of the remote file name for upload and download.
%{name}
- file name without extension
%{ext}
- file extension
You can also use formats used in
strftime(), for example, %Y
(year),
%m
(month), %d
(day), %H
(hour), %M
(minute), %S
(second), %s
(timestamp), %N
(nanosecond).
Access key ID for Aliyun OSS.
Access key secret for Aliyun OSS.
URL prefix for Aliyun OSS. https://<bucket-name>.<region>.aliyuncs.com/<root>
.
Bucket name for Aliyun OSS.
Default action of ossenc
.
# upload multiple local files to remote
ossenc localFiles...
# pipe
cat localFile | ossenc
# download to localFile
ossenc -o localFile remoteFile
# download to local, use same name
ossenc -O remoteFile
# output to stdin
ossenc -o - remoteFile
# list contents of current directory
ossenc -l
# list contents of root
ossenc -l -F /
You must build ossenc
with tag delete
.
ossenc -D remoteFiles...