Skip to content

AESKeyWrap needs updates #1080

@johnpeck-us-ibm

Description

@johnpeck-us-ibm

The AESKeyWrap code has the following APIs:

byte[] wrap(byte[] data, int start, int length)
and
byte[] unwrap(byte[] data, int start, int length)

Need to update parameter check in unwrap and copyOfRange to follow the parameter definitions;

in wrap
update byte[] inData = Arrays.copyOfRange(data, start, length);
to byte[] inData = Arrays.copyOfRange(data, start, **start+**length);

in unwrap
update check
if (data == null || start < 0 || length < start || data.length < (length - start))
to
if (data == null || start < 0 || length < start || data.length < (length + start))

and
update byte[] inData = Arrays.copyOfRange(data, start, length);
to
byte[] inData = Arrays.copyOfRange(data, start, **start+**length);

Note: We can not add any tests to verify the above since this are an internal functions and are ALWAYS called with start = 0 and length = data.length

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions