use of com.walmartlabs.concord.common.secret.BinaryDataSecret in project concord by walmartlabs.
the class SecretManager method buildBinaryData.
public BinaryDataSecret buildBinaryData(InputStream data) throws IOException {
int maxSecretDataSize = secretStoreProvider.getMaxSecretDataSize();
InputStream limitedDataInputStream = ByteStreams.limit(data, maxSecretDataSize + 1L);
BinaryDataSecret secret = new BinaryDataSecret(ByteStreams.toByteArray(limitedDataInputStream));
if (secret.getData().length > maxSecretDataSize) {
throw new IllegalArgumentException("File size exceeds limit of " + maxSecretDataSize + " bytes");
}
return secret;
}
Aggregations