CryptoServiceImpl.java revision 93f72edb164ef872eab6e4d482baa186a0dd6c62
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]".
*
* Copyright © 2011 ForgeRock AS. All rights reserved.
*/
// Java Standard Edition
// OSGi Framework
// Apache Felix Maven SCR Plugin
// JSON Fluent library
// JSON Cryptography library
// OpenIDM
/**
* Cryptography Service
*
* @author Paul C. Bryan
* @author aegloff
*/
public class CryptoServiceImpl implements CryptoService {
/**
* TODO: Description.
*/
private BundleContext context;
/**
* TODO: Description.
*/
private SimpleKeyStoreSelector keySelector;
/**
* TODO: Description.
*/
/**
* Opens a connection to the specified URI location and returns an input stream with which
* to read its content. If the URI is not absolute, it is resolved against the root of
* the local file system. If the specified location is or contains {@code null}, this
* method returns {@code null}.
*
* @param location the location to open the stream for.
* @return an input stream for reading the content of the location, or {@code null} if no location.
* @throws IOException if there was exception opening the stream.
*/
if (configFile.exists()) {
} else {
LOGGER.error("ERROR - KeyStore not found under CryptoService#location {}", configFile.getAbsolutePath());
}
}
return result;
}
try {
int keyCount = 0;
String type = IdentityServer.getInstance().getProperty("openidm.keystore.type", KeyStore.getDefaultType());
try {
LOGGER.info("Activating cryptography service of type: {} provider: {} location: {}", new Object[] {type, provider, location});
KeyStore ks = (provider == null || provider.trim().length() == 0 ? KeyStore.getInstance(type) : KeyStore.getInstance(type, provider));
while (aliases.hasMoreElements()) {
keyCount++;
}
}
} catch (IOException ioe) {
throw new InternalErrorException("IOException when loading KeyStore file of type: "
} catch (GeneralSecurityException gse) {
throw new InvalidException("GeneralSecurityException when loading KeyStore file of type: "
}
}
} catch (JsonNodeException jne) {
}
}
keySelector = null;
}
public JsonTransformer getEncryptionTransformer(String cipher, String alias) throws JsonCryptoException {
if (keySelector != null) {
}
throw new JsonCryptoException(msg);
}
}
return decryptionTransformers;
}
public JsonNode encrypt(JsonNode node, String cipher, String alias) throws JsonCryptoException, JsonException {
}
return result;
}
}
return result;
}
}
}