In section 8.3 of the RMI specification:
http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmi-stubs4.html
the following text describes the byte stream that is fed to the SHA-1 message digest:
The byte stream contains the UTF-8 encoded representation of a string
consisting of the remote method's name followed by its method descriptor
(see section 4.3.3 of The Java Virtual Machine Specification for a
description of method descriptors).
What's not clear in the above description is that the UTF-8 encoding of the string is prefixed by an unsigned, big-endian 16-bit value equal to the length of the (following) encoded string, in bytes. In other words, the byte stream is actually formatted as if the java.io.DataOutput.writeUTF method was used to write the string to a byte array. The spec should be clarified on this point.
http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmi-stubs4.html
the following text describes the byte stream that is fed to the SHA-1 message digest:
The byte stream contains the UTF-8 encoded representation of a string
consisting of the remote method's name followed by its method descriptor
(see section 4.3.3 of The Java Virtual Machine Specification for a
description of method descriptors).
What's not clear in the above description is that the UTF-8 encoding of the string is prefixed by an unsigned, big-endian 16-bit value equal to the length of the (following) encoded string, in bytes. In other words, the byte stream is actually formatted as if the java.io.DataOutput.writeUTF method was used to write the string to a byte array. The spec should be clarified on this point.
- relates to
-
JDK-4661576 (fmspec) misleading example and code in method hash specification
-
- Resolved
-