0N/A/*
2362N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.crypto.provider;
0N/A
0N/Aimport javax.crypto.ShortBufferException;
0N/A
0N/A/**
0N/A * Padding interface.
0N/A *
0N/A * This interface is implemented by general-purpose padding schemes, such as
0N/A * the one described in PKCS#5.
0N/A *
0N/A * @author Jan Luehe
0N/A * @author Gigi Ankeny
0N/A *
0N/A *
0N/A * @see PKCS5Padding
0N/A */
0N/A
0N/Ainterface Padding {
0N/A
0N/A /**
0N/A * Adds the given number of padding bytes to the data input.
0N/A * The value of the padding bytes is determined
0N/A * by the specific padding mechanism that implements this
0N/A * interface.
0N/A *
0N/A * @param in the input buffer with the data to pad
0N/A * @param the offset in <code>in</code> where the padding bytes
0N/A * are appended
0N/A * @param len the number of padding bytes to add
0N/A *
0N/A * @exception ShortBufferException if <code>in</code> is too small to hold
0N/A * the padding bytes
0N/A */
0N/A void padWithLen(byte[] in, int off, int len) throws ShortBufferException;
0N/A
0N/A /**
0N/A * Returns the index where padding starts.
0N/A *
0N/A * <p>Given a buffer with data and their padding, this method returns the
0N/A * index where the padding starts.
0N/A *
0N/A * @param in the buffer with the data and their padding
0N/A * @param off the offset in <code>in</code> where the data starts
0N/A * @param len the length of the data and their padding
0N/A *
0N/A * @return the index where the padding starts, or -1 if the input is
0N/A * not properly padded
0N/A */
0N/A int unpad(byte[] in, int off, int len);
0N/A
0N/A /**
0N/A * Determines how long the padding will be for a given input length.
0N/A *
0N/A * @param len the length of the data to pad
0N/A *
0N/A * @return the length of the padding
0N/A */
0N/A int padLength(int len);
0N/A}