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

void gnu::crypto::key::OutgoingMessage::writeMPI ( BigInteger  val  )  throws KeyAgreementException [inline]

Encodes an MPI into the message.

Parameters:
val the MPI to encode.
Exceptions:
KeyAgreementException if an encoding size constraint is violated.

Definition at line 174 of file OutgoingMessage.java.

References out.

                                                                     {
      byte[] b = val.toByteArray();
      int length = b.length;
      if (length > Registry.SASL_TWO_BYTE_MAX_LIMIT) {
         throw new KeyAgreementException("MPI is too long");
      }
      byte[] lengthBytes = { (byte)(length >>> 8), (byte) length };
      out.write(lengthBytes, 0, 2);
      out.write(b, 0, b.length);
   }


Generated by  Doxygen 1.6.0   Back to index