Interface Padding.Native

All Known Implementing Classes:
LazySodium, LazySodiumJava
Enclosing interface:
Padding

public static interface Padding.Native
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    sodiumPad(com.sun.jna.ptr.IntByReference paddedBuffLen, com.sun.jna.Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen)
    Adds extra padding to a buffer buf whose original size is unpaddedBufLen in order to extend its total length to a multiple of blocksize.
    boolean
    sodiumUnpad(com.sun.jna.ptr.IntByReference unpaddedBufLen, com.sun.jna.Pointer buf, int paddedBufLen, int blockSize)
    Computes the original, unpadded length of a message previously padded using sodiumPad(IntByReference, Pointer, int, int, int).
  • Method Details

    • sodiumPad

      boolean sodiumPad(com.sun.jna.ptr.IntByReference paddedBuffLen, com.sun.jna.Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen)
      Adds extra padding to a buffer buf whose original size is unpaddedBufLen in order to extend its total length to a multiple of blocksize.
      Parameters:
      paddedBuffLen - New length of buffer.
      buf - The buffer byte array.
      unpaddedBufLen - The length of buf with no padding.
      blockSize - Block size.
      maxBufLen - The absolute maximum you want this buffer length to be.
      Returns:
      False if the padded buffer length would exceed maxBufLen.
    • sodiumUnpad

      boolean sodiumUnpad(com.sun.jna.ptr.IntByReference unpaddedBufLen, com.sun.jna.Pointer buf, int paddedBufLen, int blockSize)
      Computes the original, unpadded length of a message previously padded using sodiumPad(IntByReference, Pointer, int, int, int). The original length is put into unpaddedBufLen.
      Parameters:
      unpaddedBufLen - This will be populated with the unpadded buffer length.
      buf - The buffer.
      paddedBufLen - The padded buffer size.
      blockSize - The block size.
      Returns:
      True if the buffer was unpadded.