All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.t.util.security.message.padding.PkcsUtil Maven / Gradle / Ivy

There is a newer version: 1.0.16.RELEASE
Show newest version
package cn.t.util.security.message.padding;

import java.util.Arrays;

public class PkcsUtil {

    /**
     * pkcs5 padding
     * @param keyBytes xxx
     * @return xxx
     */
    public static byte[] pkcs5Padding(byte[] keyBytes) {
        int length = keyBytes.length;
        int tailLength = length % 16;
        if (tailLength > 0) {
            int missing = 16 - tailLength;
            keyBytes = Arrays.copyOf(keyBytes, length + missing);
        }
        return keyBytes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy