Search in sources :

Example 6 with BinaryDataSecret

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;
}
Also used : InputStream(java.io.InputStream) BinaryDataSecret(com.walmartlabs.concord.common.secret.BinaryDataSecret)

Aggregations

BinaryDataSecret (com.walmartlabs.concord.common.secret.BinaryDataSecret)6 Path (java.nio.file.Path)3 KeyPair (com.walmartlabs.concord.common.secret.KeyPair)1 UsernamePassword (com.walmartlabs.concord.common.secret.UsernamePassword)1 ConcordApplicationException (com.walmartlabs.concord.server.sdk.ConcordApplicationException)1 ApiKeyEntry (com.walmartlabs.concord.server.security.apikey.ApiKeyEntry)1 InputStream (java.io.InputStream)1