Credential storage service stand-alone client


License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.mtakaki
ArtifactId

ArtifactId

credential-storage-client
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Credential storage service stand-alone client
Credential storage service stand-alone client
Project URL

Project URL

https://github.com/mtakaki/CredentialStorageServiceClient
Source Code Management

Source Code Management

https://github.com/mtakaki/CredentialStorageServiceClient

Download credential-storage-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mtakaki/credential-storage-client/ -->
<dependency>
    <groupId>com.github.mtakaki</groupId>
    <artifactId>credential-storage-client</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mtakaki/credential-storage-client/
implementation 'com.github.mtakaki:credential-storage-client:0.0.1'
// https://jarcasting.com/artifacts/com.github.mtakaki/credential-storage-client/
implementation ("com.github.mtakaki:credential-storage-client:0.0.1")
'com.github.mtakaki:credential-storage-client:jar:0.0.1'
<dependency org="com.github.mtakaki" name="credential-storage-client" rev="0.0.1">
  <artifact name="credential-storage-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mtakaki', module='credential-storage-client', version='0.0.1')
)
libraryDependencies += "com.github.mtakaki" % "credential-storage-client" % "0.0.1"
[com.github.mtakaki/credential-storage-client "0.0.1"]

Dependencies

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.8

test (4)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.3.0
com.github.mtakaki : credential-storage jar 0.0.2
io.dropwizard : dropwizard-testing jar 0.9.2

Project Modules

There are no modules declared in this project.

#Status Build Status Coverage Status Download Javadoc

CredentialStorageServiceClient

Java client for credential storage service. This project can be used as a stand-alone shell client or as a client library.

Setup

The client requires both private and public keys in a DER format.

$ openssl pkcs8 -topk8 -inform PEM -outform DER -in id_rsa -nocrypt > private_key.der
$ openssl rsa -in id_rsa -out public_key.der -outform DER -pubout

The private key is never sent to the server, only the public key. The private key is only used to decrypt the incoming data.

Stand-alone client

To use the client as a shell stand-alone client, you will need to build the project and use the runnable jar file.

It takes the following arguments:

usage:   --delete | --get | --update | --upload  [-p <arg>] -priv <arg>
       -pub <arg> [-s <arg>] -u <arg>
Credential service client

    --delete             Delete credentials
    --get                Retrieves credentials
 -p,--primary <arg>      Primary credential
 -priv,--private <arg>   Private key file
 -pub,--public <arg>     Public key file
 -s,--secondary <arg>    Secondary credential
 -u,--url <arg>          Credential service URL
    --update             Update existing credentials
    --upload             Upload new credentials

Please report issues at
https://github.com/mtakaki/CredentialStorageService/issues

Get credentials

$ java -jar target/credential-storage-client-0.0.1-SNAPSHOT.jar --get --priv src/test/resources/private_key.der --pub src/test/resources/public_key.der -u https://damp-sea-57022.herokuapp.com/ | jq .
{
  "primary": "test user",
  "secondary": "青"
}

Upload credentials

$ java -jar target/credential-storage-client-0.0.1-SNAPSHOT.jar --priv src/test/resources/private_key.der --pub src/test/resources/public_key.der -u https://damp-sea-57022.herokuapp.com/ --upload --primary "test user" --secondary "青"
Credential successfully uploaded!

If upload is used with an existing credential it will completely override the existing one and regenerate a new symmetrical key.

Update credentials

$ java -jar target/credential-storage-client-0.0.1-SNAPSHOT.jar --priv src/test/resources/private_key.der --pub src/test/resources/public_key.der -u https://damp-sea-57022.herokuapp.com/ --update --primary "user"
Credential successfully updated!

Update supports partial updates, so it preserves the existing information. The symmetrical key is regenerated nonetheless.

Delete credentials

$ java -jar target/credential-storage-client-0.0.1-SNAPSHOT.jar --priv src/test/resources/private_key.der --pub src/test/resources/public_key.der -u https://damp-sea-57022.herokuapp.com/ --delete
Credential successfully deleted!

Versions

Version
0.0.1