Skip to content

Commit

Permalink
Small code fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebusscher committed Aug 2, 2018
1 parent 1bd2ce1 commit ad9cb7a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class JwtSupportConfiguration extends AbstractConfiguration implements Mo
/**
* The return value can also be a directory where multiple files are located (and retrieved).
*
* @return
* @return Location, file or directory where the keys are located.
*/
@ConfigEntry
public String getKeysLocation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public List<AtbashKey> readKeyResource(String path, KeyResourcePasswordLookup pa
if (keyResourceType == null) {
throw new UnknownKeyResourceTypeException(path);
}
// FIXME keyResourceType == null -> Exception.
switch (keyResourceType) {

case JWK:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class KeyReaderKeyStore {
public List<AtbashKey> readResource(String path, KeyResourcePasswordLookup passwordLookup) {
List<AtbashKey> result = new ArrayList<>();

KeyStore keyStore = null;
KeyStore keyStore;
try {
keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
} catch (KeyStoreException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,27 +144,27 @@ private void writeFile(String target, byte[] fileContent) throws IOException {
outputStream.close();
}

public byte[] writeKeyResource(AtbashKey atbashKey, KeyResourceType keyResourceType, char[] keyPasssword, char[] filePassword) {
public byte[] writeKeyResource(AtbashKey atbashKey, KeyResourceType keyResourceType, char[] keyPassword, char[] filePassword) {
checkDependencies();
byte[] result;
try {
switch (keyResourceType) {

case JWK:
// FIXME support for encrypted JWK of Atbash (see JWKEncryptedCreator)
result = writeKeyAsJWK(atbashKey, keyPasssword);
result = writeKeyAsJWK(atbashKey, keyPassword);
break;
case JWKSET:
result = writeKeyAsJWKSet(atbashKey, new JWKSet());
break;
case PEM:
result = writeKeyAsPEM(atbashKey, keyPasssword);
result = writeKeyAsPEM(atbashKey, keyPassword);
break;
case KEYSTORE:
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(null, null);

result = writeKeyAsKeyStore(atbashKey, keyPasssword, filePassword, keyStore);
result = writeKeyAsKeyStore(atbashKey, keyPassword, filePassword, keyStore);
break;
default:
throw new IllegalArgumentException(String.format("Unsupported value for KeyResourceType : %s", keyResourceType));
Expand Down

0 comments on commit ad9cb7a

Please sign in to comment.