Java Code Examples for com.netflix.spinnaker.kork.secrets.EncryptedSecret#isEncryptedFile()
The following examples show how to use
com.netflix.spinnaker.kork.secrets.EncryptedSecret#isEncryptedFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecretsManagerSecretEngine.java From kork with Apache License 2.0 | 6 votes |
@Override public byte[] decrypt(EncryptedSecret encryptedSecret) { String secretRegion = encryptedSecret.getParams().get(SECRET_REGION); String secretName = encryptedSecret.getParams().get(SECRET_NAME); String secretKey = encryptedSecret.getParams().get(SECRET_KEY); if (encryptedSecret.isEncryptedFile()) { GetSecretValueResult secretFileValue = getSecretValue(secretRegion, secretName); if (secretFileValue.getSecretBinary() != null) { return secretFileValue.getSecretBinary().array(); } else { return secretFileValue.getSecretString().getBytes(); } } else if (secretKey != null) { return getSecretString(secretRegion, secretName, secretKey); } else { return getSecretString(secretRegion, secretName); } }
Example 2
Source File: SecretsManagerSecretEngine.java From kork with Apache License 2.0 | 5 votes |
@Override public void validate(EncryptedSecret encryptedSecret) { Set<String> paramNames = encryptedSecret.getParams().keySet(); if (!paramNames.contains(SECRET_NAME)) { throw new InvalidSecretFormatException( "Secret name parameter is missing (" + SECRET_NAME + "=...)"); } if (!paramNames.contains(SECRET_REGION)) { throw new InvalidSecretFormatException( "Secret region parameter is missing (" + SECRET_REGION + "=...)"); } if (encryptedSecret.isEncryptedFile() && paramNames.contains(SECRET_KEY)) { throw new InvalidSecretFormatException("Encrypted file should not specify key"); } }
Example 3
Source File: FileService.java From halyard with Apache License 2.0 | 2 votes |
/** * Indicates if the given file reference is for a remote (secret reference, config server) or * local file. * * @param fileReference to be checked. * @return true if it's a remote file. */ public boolean isRemoteFile(String fileReference) { return CloudConfigResourceService.isCloudConfigResource(fileReference) || EncryptedSecret.isEncryptedFile(fileReference); }