Собственно вопрос следующий. Как вычитать с симки её ICC-ID? Почему-то не на всех симках есть полный 20-ти значный номер.
Или иначе, как восстановить последнюю контрольную циферь при наличии первых девятнадцати?
Собственно вопрос следующий. Как вычитать с симки её ICC-ID? Почему-то не на всех симках есть полный 20-ти значный номер.
Или иначе, как восстановить последнюю контрольную циферь при наличии первых девятнадцати?
Сообщение от Master_X
Лёгко!
Например, Cardinal 0.99.110F или скриптом…
Т.к. вопрос очень финансово интересный )), то:
*
The maximum length of the visible card number (primary account number) should be 19 characters and is composed of the following subparts
- Major Industry Identifier (MII) = 89;
- country code;
- issuer identifier;
- individual account identification number
- parity check digit computed according to the Luhn formula (ISO/IEC 7812, Annex B или ГОСТ Р 50809-95 ).
*
The algorithm used to arrive at the proper check digit is called the Luhn algorithm, after IBM scientist Hans Peter Luhn (1896-1964), who was awarded US Patent 2950048 ("Computer for Verifying Numbers") for the technique in 1960
"For a card with an even number of digits, double every odd numbered digit and subtract 9 if the product is greater than 9. Add up all the even digits as well as the doubled-odd digits, and the result must be a multiple of 10 or it's not a valid card. If the card has an odd number of digits, perform the same addition doubling the even numbered digits instead."
The bit about even and odd is a little confusing. The main point is that you don't want to double the check digit, and this can easily be done by starting with the check digit, going backwards, and doubling every other digit.
************ Source Code
//---------------------------------------------------------
// Checks for valid card number using Luhn algorithm
//---------------------------------------------------------
public abstract class LuhnCheck {
//--------------------------------
// Filter out non-digit characters
//--------------------------------
private static String getDigitsOnly (String s) {
StringBuffer digitsOnly = new StringBuffer ();
char c;
for (int i = 0; i < s.length (); i++) {
c = s.charAt (i);
if (Character.isDigit (c)) {
digitsOnly.append (c);
}
}
return digitsOnly.toString ();
}
//-------------------
// Perform Luhn check
//-------------------
public static boolean isValid (String cardNumber) {
String digitsOnly = getDigitsOnly (cardNumber);
int sum = 0;
int digit = 0;
int addend = 0;
boolean timesTwo = false;
for (int i = digitsOnly.length () - 1; i >= 0; i--) {
digit = Integer.parseInt (digitsOnly.substring (i, i + 1));
if (timesTwo) {
addend = digit * 2;
if (addend > 9) {
addend -= 9;
}
}
else {
addend = digit;
}
sum += addend;
timesTwo = !timesTwo;
}
int modulus = sum % 10;
return modulus == 0;
}
//-----
// Test
//-----
public static void main (String[] args) {
String cardNumber = "4408 0412 3456 7890";
boolean valid = LuhnCheck.isValid (cardNumber);
System.out.println (cardNumber + ": " + valid);
cardNumber = "4408 0412 3456 7893";
valid = LuhnCheck.isValid (cardNumber);
System.out.println (cardNumber + ": " + valid);
cardNumber = "4417 1234 5678 9112";
valid = LuhnCheck.isValid (cardNumber);
System.out.println (cardNumber + ": " + valid);
cardNumber = "4417 1234 5678 9113";
valid = LuhnCheck.isValid (cardNumber);
System.out.println (cardNumber + ": " + valid);
}
}
B)
function checkLuhn(string purportedCC) {
int sum := 0
int nDigits := length(purportedCC)
int parity := nDigits modulus 2
for i from 0 to nDigits - 1 {
int digit := integer(purportedCC[i])
if i modulus 2 = parity
digit := digit × 2
if digit > 9
digit := digit - 9
sum := sum + digit
}
return (sum modulus 10) = 0
}
C)
Python Source Code
def cardLuhnChecksumIsValid(card_number):
sum = 0
num_digits = len(card_number)
oddeven = num_digits & 1
for count in range(0, num_digits):
digit = int(card_number[count])
if not (( count & 1 ) ^ oddeven ):
digit = digit * 2
if digit > 9:
digit = digit - 9
sum = sum + digit
return ( (sum % 10) == 0 )
etc…
Если я не ошибаюсь easy sim 7.20 считывает ICC-ID карты
А про что собственно код?
Собственно, про то что спрашивали...Сообщение от telef
LuhnCheck - ЛОХ ЧЕК! на четырех языках! (уже понял, - хорошо, что оставшиеся шесть не привел )
P.S. Особенность этого форума - вместо J_a_v_a рисовать **********
Зачем программу то писать? Если он и так в открытом виде лежит?Сообщение от abvg
@telefСообщение от Master_X
Рекомендую прочитать начало этого треда.
Восстановление - процедура, а процедуры описываюся алгоритмом: "набором описаний последовательных действий на некотором языке, необходимых для того, чтобы компьютер или интеллектуальное устроиство выполнили за конечное время некоторую задачу" Это проходят в 9 классе...
Я привел ПОЛНОЕ описание ICCID со всеми мыслимыми (стандартами) и немыслимыми (патентами) ссылками, по которым легко разобраться с любыми, как телефонными, так и банковскими картами и картами спутникового телевидения(НТВ+). Наибольший интерес в этой картинке представляет т.н. "алгоритм Луна", который и строит "последнюю контрольную циферь при наличии первых девятнадцати" Т.к. данный алгоритм - ядро всех схем проверки корректности номера карт, то я привел его описание на англо-фрикерном, Яве, Питоне и, конечно, Си.
> Если он и так в открытом виде лежит?
Где лежит, а где и нет...
Видимо, следующее описание будет на русском-матерном (как в воду смотрел!)
@Master_X
Что молчишь?
Благодарю за справку!
@abvg
Ну вообщем-то пока молчу, от того что пытаюсь это дело
переварить. И даже наверное переставить акценты в вопросе,
ибо вижу вопрос я задал не верно. Попытаюсь его исправить.
Начнём с ответов.
1. ICC-ID как правило указан на самой SIM карте, со стороны чипа либо с другой стороны.
2. ICC-ID считывает Woron-Scan, при помощи phoenix card reader. Кнопка там на тулбаре есть, так и называется ICC(жмёшь и получаешь ICC-ID)
Теперь вопросы.
1. ICC-ID может ли быть 19-значным или только 20-значным?
2. Его(ICC-ID) функции в GSM (применительно к silvercard и вообще в
вопросе клонирования)
P.S. Учитывая уровень предыдущих ответов. Надеюсь на пусть не
совсем лаконичный, но исчерпывающий ответ.
Спасибо за проявленное внимание.
Последний раз редактировалось Master_X; 09.03.2006 в 12:31.
На сегодня ответ – 10 байт, но 19 цифр (Можно и 20, но тогда: «Сама, сама, Верунчик, сама…»)Сообщение от Master_X
1. В краеугольном стандарте
GSM 11.11 (ETS 300 608): "European digital cellular telecommunications system (Phase 2); Specification of the Subscriber Identity Module - Mobile Equipment (SIM - ME) interface".
написано:
А)
The information on the exterior of either SIM should include at least the individual account identifier and the check digit of the IC Card Identification
Б)
Identifier: '2FE2' EF ICC_ID
Contents:
according to CCITT Recommendation E.118. However, network operators who are already issuing Phase 1 SIM cards with an identification number length of 20 digits may retain this length.
Coding:
BCD, left justified and padded with 'F'; after padding the digits within a byte are swapped (see below). However, network operators who are already issuing Phase 1 SIM cards where the digits within a byte are not swapped may retain this configuration.
2 Теперь смотрим Е.118 (вынужден скопировать свой пост из другого трейда, тк его не читают)
ITU-T Recommendation E.118 "The international telecommunication charge card" (с картинками)
1 Preamble
Telecommunication charge cards may be issued by Recognized Operating Agencies (ROAs) to allow customers to use their card in connection with various international services at appropriate charges for each transaction and have the charges billed to their account in the country where the ROA issued the charge card. Cards issued by ROAs in accordance with this Recommendation conform to the appropriate ISO Standards.
2 Numbering system
2.1 Card numbering structure
The numbering of the card to be issued by ROAs shall be as follows based on International Standard ISO/IEC 7812 (Identification cards – Numbering system and registration procedure for issuer identifiers).
The maximum length of the visible card number (primary account number) should be 19 characters and is composed of the following subparts (see Figure 1):
– Major Industry Identifier (MII);
– country code;
– issuer identifier;
– individual account identification number;
– parity check digit computed according to the Luhn formula (see International Standard ISO/IEC 7812 , Annex B). In addition to the parity check digit, ROAs may incorporate a validation check device in some location on the card which could be changed when new cards are issued.
NOTE – Major industry and issuer identifier numbers of the form 66xxxx have already been assigned to some Administrations as a transitional measure. Charge cards of this type are fully compatible with ISO standards.
2.2 Issuer identifier number assignment and registration procedure
a) The assignment of specific issuer identifier numbers should be the responsibility of a country or group of countries as appropriate. These numbers should only be assigned to ROAs with the agreement of their Administrations.
b) These issuer identifier numbers are normally used to distinguish among multiple ROAs who issue cards within a country. However, these numbers may also be used to distinguish individual countries sharing the same country code (as defined in Recommendation E.164 [2]) or, if appropriate, to distinguish both countries and issuers.
c) The Director of the TSB is responsible for the registration and/or cancellation of issuer identifier numbers (IINs) for ROAs with the approval of their Administrations. An illustrative registration form is contained in Figure 2.
d) A one time fee shall be collected in order for an IIN to be assigned and registered by the TSB. Applications shall be accompanied by evidence of payment to the ITU of the one time fee.
e) In the event of technical or operational difficulties in allocating an IIN, the Director of the TSB should consult the Chairman of Study Group 1.
f) The TSB shall maintain a list of the allocated IINs.
g) Additions, deletions and changes to this list should be published in the first available ITU Operational Bulletin.
h) The consolidated list of allocated IINs should be published periodically in the ITU Operational Bulletin.
2.3 Information content
The information on an international telecommunication charge card should clearly include:
1) the card number (on a combined national/international card; the national number, if different, should be appropriately designated);
and optionally include:
2) the name of the issuing ROA1) and, where appropriate, the country of issue;
3) the card holder’s name and signature;
4) the date of expiry;
5) instructions on how the card should be used. (Some ROAs may prefer to issue instructions separately.)
In addition, the logo of the ITU may, at the card issuer’s option, appear somewhere on the card to facilitate recognition of the card by card acceptors where presentation of the card is required as a part of the service (i.e. bureau services).
Не убавить не прибавить...
________________________________________
Последний раз редактировалось abvg, 07.03.2006 в 15:19.
В) для тестирования используется официальная процедура:
b) The SIM is connected to an ME simulator.
c) The ME simulator resets the SIM.
d) The ME simulator sends a SELECT command to the SIM to select EF ICCID.
e) The ME simulator sends a READ BINARY command to the SIM to read the identification number.
The individual account identifier read from the SIM shall be identical with that on the exterior of the card
О, как!
На второй вопрос я начал отвечать в специальном цикле трейдов на этом форуме, но какой-то злой дядька все уничтожил
Я давал список недостатков всех эму, которыми вы пользуетесь и приглашал к обсуждению, но...
(Один откуда-то telef вытащил)
Смысл в двух словах: Надо писать ПРАВИЛЬНЫЕ эмуляторы, а то чем мы пользуемся таковыми не являются (со всеми последствиями!)
Выше я пытался показать, что и когда можно, а чего нельзя!
Если у вас Фаза1, то не лезьте за сервисами Фазы2, во всяком случае, дуриком...