Motorola E680 Technical Manual - Page 44

Motorola implementation supports a HTTPS connection on the Motorola E680 handset.

Page 44 highlights

HTTPS Connection Motorola implementation supports a HTTPS connection on the Motorola E680 handset. Additional protocols that will be supported are the following: • TLS protocol version 1.0 as defined in http://www.ietf.org/rfc/rfc2246.txt • SSL protocol version 3.0 as defined in http://home.netscape.com/eng/ssl3/draft302.txt The following is a code sample to show implementation of HTTPS: HTTPS import javax.microedition.io.*; import java.io.*; import javax.microedition.midlet.*; ... try { hc[i] = (HttpConnection)Connector.open("https://" + url[i] + "/"); } catch (Exception ex) { hc[i] = null; System.out.println("Open Failed: " + ex.getMessage()); } if (hc[i] != null) { try { is[i] = hc[i].openInputStream(); byteCounts[i] = 0; readLengths[i] = hc[i].getLength(); System.out.println("readLengths = " + readLengths[i]); if (readLengths[i] == -1) { readLengths[i] = BUFFER_SIZE; } int bytes_read = 0; int offset = 0; int bytes_left = (int)readLengths[i]; do 44

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107

44
HTTPS Connection
Motorola implementation supports a HTTPS connection on the Motorola E680 handset.
Additional protocols that will be supported are the following:
TLS protocol version 1.0 as defined in
SSL protocol version 3.0 as defined in
The following is a code sample to show implementation of HTTPS:
HTTPS
import javax.microedition.io.*;
import java.io.*;
import javax.microedition.midlet.*;
try {
hc[i] =
(HttpConnection)Connector.open(“https://” + url[i] + "/");
} catch (Exception ex) {
hc[i] = null;
System.out.println("Open Failed: " +
ex.getMessage());
}
if (hc[i] != null)
{
try {
is[i] = hc[i].openInputStream();
byteCounts[i] = 0;
readLengths[i] = hc[i].getLength();
System.out.println("readLengths = " +
readLengths[i]);
if (readLengths[i] == -1)
{
readLengths[i] = BUFFER_SIZE;
}
int bytes_read = 0;
int offset = 0;
int bytes_left = (int)readLengths[i];
do