use of org.bouncycastle.crypto.RuntimeCryptoException in project ranger by apache.
the class RangerGoogleCloudHSMProvider method onInitialization.
@Override
public void onInitialization() throws Exception {
this.validateGcpProps();
if (logger.isDebugEnabled()) {
logger.debug("==> onInitialization() : {gcpProjectId - " + this.gcpProjectId + ", gcpLocationId - " + this.gcpLocationId + ", gcpKeyRingId - " + this.gcpKeyRingId + ", gcpAppCredFile Path - " + this.gcpAppCredFile + "}");
}
String errorMessage = null;
client = getKeyClient(this.gcpAppCredFile);
KeyRing keyRingResponse = null;
if (client != null) {
this.keyRingName = KeyRingName.of(this.gcpProjectId, this.gcpLocationId, this.gcpKeyRingId);
if (this.keyRingName != null) {
keyRingResponse = this.client.getKeyRing(this.keyRingName.toString());
if (keyRingResponse == null) {
errorMessage = "Unable to get Key Ring response for Project : " + this.gcpProjectId + " and Location : " + this.gcpLocationId;
} else if (keyRingResponse != null && !keyRingResponse.getName().endsWith(this.gcpKeyRingId)) {
errorMessage = "Key Ring with name : " + this.gcpKeyRingId + " does not exist for Project : " + this.gcpProjectId + " and Location : " + this.gcpLocationId;
}
} else {
errorMessage = "Unable to get Key Ring response for Project : " + this.gcpProjectId + " and Location : " + this.gcpLocationId;
}
} else {
errorMessage = "Unable to create client object for Google Cloud HSM. Please check the Key HSM Log file OR Verify Google App Credential JSON file.";
}
if (logger.isDebugEnabled()) {
logger.debug("<== onInitialization() : {this.keyRingName - " + this.keyRingName + ", keyRingResponse - " + keyRingResponse + "}");
}
if (!StringUtils.isEmpty(errorMessage)) {
throw new RuntimeCryptoException(errorMessage);
}
}
Aggregations