Skip to content

Avoid allocating array just to fill secure buffer #9

@westonal

Description

@westonal
    private static void populateBufferWithSecureKeyData(ByteBuffer key) {
        final Random random = new SecureRandom();
        final byte bytes[] = new byte[key.capacity()];
        random.nextBytes(bytes);
        key.put(bytes);
        Arrays.fill(bytes, (byte) 0);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions