Logo Search packages:      
Sourcecode: libgnucrypto-java version File versions  Download package

BigInteger gnu::crypto::key::IncomingMessage::readMPI (  )  throws KeyAgreementException [inline]

Decodes an MPI from the current message's contents.

a native representation of an MPI.
KeyAgreementException if an encoding exception occurs during the operation.

Definition at line 224 of file IncomingMessage.java.

References in, and twoBytesToLength().

      if (in.available() < 2) {
         throw new KeyAgreementException("not enough bytes for an MPI in message");
      byte[] elementLengthBytes = new byte[2];
      in.read(elementLengthBytes, 0, 2);
      int elementLength = twoBytesToLength(elementLengthBytes);
      if (in.available() < elementLength) {
         throw new KeyAgreementException("illegal MPI encoding");

      byte[] element = new byte[elementLength];
      in.read(element, 0, element.length);

      return new BigInteger(1, element);

Generated by  Doxygen 1.6.0   Back to index