Package javax.crypto

Examples of javax.crypto.ShortBufferException


        {
            return cipher.processBytes(input, inputOffset, inputLen, output, outputOffset);
        }
        catch (DataLengthException e)
        {
            throw new ShortBufferException(e.getMessage());
        }
    }
View Full Code Here


        return inputLen;
        }
        catch (DataLengthException e)
        {
            throw new ShortBufferException(e.getMessage());
        }
    }
View Full Code Here

        {
            return cipher.processBytes(input, inputOffset, inputLen, output, outputOffset);
        }
        catch (DataLengthException e)
        {
            throw new ShortBufferException(e.getMessage());
        }
    }
View Full Code Here

        return inputLen;
        }
        catch (DataLengthException e)
        {
            throw new ShortBufferException(e.getMessage());
        }
    }
View Full Code Here

            throw new IllegalStateException
                ("Key agreement has not been completed yet");
        }

        if (sharedSecret == null) {
            throw new ShortBufferException
                ("No buffer provided for shared secret");
        }

        BigInteger modulus = init_p;
        byte[] secret = this.y.modPow(this.x, modulus).toByteArray();

        // BigInteger.toByteArray will sometimes put a sign byte up front,
        // but we NEVER want one.
        if ((secret.length << 3) != modulus.bitLength()) {
            if ((sharedSecret.length - offset) < (secret.length - 1)) {
                throw new ShortBufferException
                    ("Buffer too short for shared secret");
            }
            System.arraycopy(secret, 1, sharedSecret, offset,
                             secret.length - 1);

            // Reset the key agreement here (not earlier!), so that people
            // can recover from ShortBufferException above without losing
            // internal state
            generateSecret = false;

            return secret.length - 1;

        } else {
            if ((sharedSecret.length - offset) < secret.length) {
                throw new ShortBufferException
                    ("Buffer too short to hold shared secret");
            }
            System.arraycopy(secret, 0, sharedSecret, offset, secret.length);

            // Reset the key agreement here (not earlier!), so that people
View Full Code Here

TOP

Related Classes of javax.crypto.ShortBufferException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.