sprops

secure properties api

Лицензия

Лицензия

Категории

Категории

Ant Компиляция и сборка
Группа

Группа

com.github.antonsjava
Идентификатор

Идентификатор

sprops
Последняя версия

Последняя версия

1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

sprops
secure properties api
Ссылка на сайт

Ссылка на сайт

https://github.com/antonsjava/sprops
Система контроля версий

Система контроля версий

https://github.com/antonsjava/sprops

Скачать sprops

Имя Файла Размер
sprops-1.1.pom
sprops-1.1.jar 102 KB
sprops-1.1-sources.jar 27 KB
sprops-1.1-javadoc.jar 550 KB
Обзор

Как подключить последнюю версию

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.github.antonsjava : jaul jar 1.5
com.github.antonsjava : slformatter jar 1.1

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

sprops

sprops is small library for encoding and decoding property files or simple string data.

Motivation for this project was to have possibility to store secret data like passwords together with sources or have it stored somewhere else publicly.

Property file with encoded properties are protected with one password. This must be provided 'secretly' but this one only.

sprops-tool

This is command line tool for manipulating the property files. Tool can be build by building this project.

Than you can use it for encoding and decoding properties in property file

Lets have simple property file like

  main.db.password=xxxx
  email.server.password=yyyy

than you can call

  /tmp/aaa> java -jar sprops-tool.jar -fencode passwords.properties  main.db.password
  INF   main command to execute FileEncodeCommand
  Enter password: 
  INF c.fenc Property: 'main.db.password'
  INF c.fenc Encoding string from: 'xxxx'
  INF c.fenc                   to: 'sprops:AAAAIBnzWe9H8rJtXVsOtBApsVC74BldooOGHOu4h1GJWuMpMpWXnD3b/vYurPjmHYM1Ww=='
  INF   main command FileEncodeCommand execution done.

and property looks like

  main.db.password=sprops:AAAAIBnzWe9H8rJtXVsOtBApsVC74BldooOGHOu4h1GJWuMpMpWXnD3b/vYurPjmHYM1Ww==
  email.server.password=yyyy

you can than call

  /tmp/aaa> java -jar sprops-tool.jar -fdecode passwords.properties  main.db.password
  INF   main command to execute FileDecodeCommand
  Enter password: 
  INF c.fdec Property: 'main.db.password'
  INF c.fdec Encoding string from: 'sprops:AAAAIBnzWe9H8rJtXVsOtBApsVC74BldooOGHOu4h1GJWuMpMpWXnD3b/vYurPjmHYM1Ww=='
  INF c.fdec                   to: 'xxxx'
  INF   main command FileDecodeCommand execution done.

and property looks like

  main.db.password=xxxx
  email.server.password=yyyy

There are also other options you can see it with --help option.

Property file usage

Encoded file can be used in application

  String password = .....
  Properties encodedProps = .....
  PropertiesEncoder encoder = PropertiesEncoder.instance(password);
  encoder.add(encodedProps);
  String decodedProperty = encoder.getProperty("property.name");
  Properties decodedProps = encoder.decode();

Simple encoding/decoding

You can use

  String password = .....
  String text = .....
  SimpleEncoder encoder = SimpleEncoder.instance(password);
  String encodedString = encoder.encode(text);
  String decodedString = encoder.decode(encodedString);

System properties utility

If you are using spring boot and you want to have encoded properties provide as SB property. An easy way is copy the properties to System properties at wery first moment of starting application

  Properties props = .....
  SystemPropertiesUpdater.instance(props)
    .map("main.db.password", "spring.datasource.password")
    .map("email.server.password", "myapp.notifier.password");

Maven usage

   <dependency>
      <groupId>com.github.antonsjava</groupId>
      <artifactId>sprops</artifactId>
      <version>1.1</version>
   </dependency>

Версии библиотеки

Версия
1.1