com.thelastcheck.commons.base.security.CredentialsReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tlc-commons-base Show documentation
Show all versions of tlc-commons-base Show documentation
TLC Command Base Utilities and Classes
/**
* ****************************************************************************
* The Last Check, LLC
* 9499 Grove Trail Lane
* Germantown, TN 38139
*
* Unauthorized distribution, adaptation or use may be subject to civil and
* criminal penalties.
*
* Copyright (c) 2015, The Last Check, LLC, All rights reserved.
* ****************************************************************************
*/
package com.thelastcheck.commons.base.security;
import com.google.common.io.ByteSource;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
public class CredentialsReader {
private ByteSource source;
public CredentialsReader(File file) {
this(Files.asByteSource(file));
}
public CredentialsReader(ByteSource source) {
this.source = source;
}
public Credentials read() throws IOException, CredentialsEncryptionException {
byte[] ba = source.read();
CredentialsEncrypter encrypter = new CredentialsEncrypter();
return encrypter.decrypt(ba);
}
}