COMP315 (Technologies for E-Commerce)
Recommenders give personalised recommendations to users about that to watch, read, listen or buy.
Recommenders are usually provided as part of the service it provides recommendations for (like YouTube):
- Independent recommenders are at a huge disadvantage due to a lack of data.
This gives the following advantages:
Revenue Model |
Benefit |
Sales Model |
More sales |
Advertising Model |
More ad views |
Subscription Model |
Higher customer value perception. |
A software agent that assists a user.
User’s, Services and Interfaces
- Bots act as an interface, connecting a user to a service.
- A service is anything you want to access.
- User might be human but could be some other software.
Bots for E-Commerce
We will generally have to make the following decisions concerning bots:
- For customer assistance?
- For employee/company assistance?
- Can third party bots use the service?
Customer Support
We may see the following different types:
- Dumb bots/similar to human support.
- Information only/can take actions.
When making a customer support bot we should keep the following in mind:
- High authority requires high reliability.
- Licensing existing bots works well for complex bots.
- Scripts/flowcharts for human support can often be used as a basis for a bot, especially when less sophisticated.
You should weigh whether the bot is really better than a FAQ or human customer support. If so you should still provide it alongside the alternatives.
Encouraging Bots
- Define an API that bots can interact with.
- This also shows what functions you allow users to interact with.
Creating API documentation encourages users to use the correct endpoint for their data.
Discouraging Bots
robots.txt
This is a file, generally aimed at search engines, that discourages bots from reading certain pages or following links on pages.
A bot doesn’t have to comply with robots.txt
or robots meta tags.
Blocking Bots
- If there is a large amount of traffic from a single or small range of IPs then they can be blocked if poor behaviour is detected.
This may create false positives but this can be acceptable anyway.
CAPTCHA
We can use CAPTCHA checks, like reCAPTCHA, to ensure any users are human:
- This is becoming harder with AI models that can solve modern CAPTCHA problems.
The GDPR also gives specific rights to individuals:
- Some of these interact with lawful bases.
- Others overlap with the duties of controllers and processors.
The rights are:
- Right to be informed.
- Right of access:
- Responses should usually be given to the individual, even for children.
- Right to rectification.
- Right to erasure.
- Right to restrict processing:
- This includes deletion.
- Can be useful while investigating data a company holds on an individual.
- Right to data portability:
- Only applicable to consent or contract.
- Only applicable if processing is automated.
- Must be machine-readable.
- Right to object:
- If you use the data for marketing.
- Can be requested under public or legitimate interest.
- Rights in relation to automated decision making:
- Can request a human to make the decision again.
Requests
Requests can be made in any form:
- Written or verbal.
- Without referencing any specific terminology.
Generally without fee:
- Unless requests are excessive or unfounded.
Right to Privacy
No one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, nor to attacks upon his honour and reputation. Everyone has the right to the protection of the law against such interference or attacks. - Art.12 UDHR
There are several reasons to want privacy:
- Direct Harm
- Harm to physical goods, possessions and reputation.
- Indirect Harm
- Harm that would stop you from doing something you would otherwise.
- Someone watching your every move is not a nice feeling.
Privacy Considerations
- Sensitivity
- All information deserves some protection, but sensitive information deserves more.
A bag search at a nightclub is reasonable but a cavity search is not.
- Target Individual
- Children and vulnerable people have increase privacy rights. Public people (politicians and celebrities) have reduced rights.
Children have greatly reduced privacy rights with their parents.
- Extent of Disclosure
- Privacy is harmed more by public disclosure than by one person getting a glimpse.
- Justification
- Better reasons allow greater invasion of privacy. Consent removes the limitations they allow.
GDPR
Check the official guide to data protection at https://ico.org.uk/for-organisations/guide-to-data-protection/guide-to-the-general-data-protection-regulation-gdpr/.
There is also the ePrivacy Regulation in the EU that regulates cookies and mailing lists.
Personal Data
The GDPR applies to any person or organisation that processes personal data.
- Personal Data
- Information relating to an identifiable living individual.
- Identifiable
- Enough to distinguish one person from another.
Only full anonymisation can make something not personal data.
Information is still personal if it can be combined with public domain information to identify a person.
Processing data means doing any of the following:
- Viewing
- Storing
- Modifying/Combining
- Deleting
- Publishing
Controlling data means deciding how and to what purpose it will be processed. This is where the main responsibility lies, they must pay the data protection fee to the ICO.
Principles
The GDPR is organised around seven principles:
- Lawfulness, Fairness & Transparency
- Purpose Limitation
- Data Minimisation
- Accuracy
- Storage Limitation
- Integrity & Confidentiality (Security)
- Accountability.
Lawful Basis
One of the following bases must be chosen before collecting data and may not be chosen later. There are six possible bases:
- Consent:
- Must be opt-in.
- Must be granular.
- Must be informed.
- Must be freely given.
- Can be withdrawn.
Consent is a great basis if you can get it.
- Contract
- When supplying contracted services.
- To provide services with the intention of entering a contract (supplying a quote).
This is the easiest basis to use in e-commerce.
- Legal Obligation
- Tax
- Counter-Terrorism & Security Act
- Court Orders
- Regulations
- Vital Interests
- When data processing is required to save a life.
Cannot be used if the data subject is capable of consent. Alternatives must be considered if the subject is not the same person as the individual at risk.
- Public Interest
- When acting under official authority.
- Typically government, public organizations or utilities.
- Legitimate Interest
- A legal & moral interest.
- Can be commercial or in anyone’s interest.
- Only if the individual’s interests align with the legitimate interest (balance test).
This is a good last resort if the others don’t fit.
In each case, the lawful basis only applies to data processing that is necessary. If a reasonable, less invasive alternative exists, that is not too difficult or expensive, then it should be used instead.
Necessity doesn’t include commercial gains: “You must consent to using your data for advertising or we can’t provide the service.”
Special Category & Criminal Offence Data
The following two data categories require more protection:
- Special category data.
- Criminal offence data.
Purpose and basis won’t suffice in these cases.
Special Category Data
The following are classed as special category data:
- Racial or ethnic origin.
- Political opinions.
- Religious or philosophical beliefs.
- Trade union membership.
- Genetics
- Biometrics
- Health
- Sex Life
- Sexuality
To process any data of this type, in addition to purpose and lawful basis, you need one of the following conditions:
- Consent
- Same condition as the lawful basis.
- Can still be used if a different basis is used for the lawful basis.
- Vital Interests
- Only available if the subject is incapable of consent.
- You are a trade union, political, religious or philosophical organisation.
- Only applies to members of your organisation.
- Only applies to data that applies to your organisation.
- The individual has made this data public.
- The data is necessary for a legal defence, or legal proceedings.
- Employment, social security and social protection.
- Right to work.
- Health & Safety
- Disability support.
- Substantial Public Interest
- There are 23 specific conditions that allow use of this basis.
Not recommended.
- Health or social care.
- Public Health
- Archiving, research and statistics in the public interest.
The last 5 cases require reference to local law (DPA 2018 in the UK).
In all cases, consider whether pseudo-anonymisation is possible.
Criminal Offence Data
This includes data about:
- Allegations
- Investigations
- Legal Proceedings
- Convictions
- Penalties (Punishments)
Processing criminal offence data is only allowed:
-
For an official authority.
Only party allowed to hold a comprehensive register of criminal offence data.
-
One of the following conditions from special category data applies:
- Employment, social security and social protection.
- Substantial Public Interest
- Health or social care.
- Public Health
- Archiving, research and statistics in the public interest.
Network Topology
Direct Connection
The simplest network is a direct connection between two peers that wish to communicate.
This doesn’t scale well and is costly. For $x$ nodes there will be:
\[\frac{x(x-1)}{2}\]
connections.
They are useful if you require:
- Extreme Speed
- Extreme Secrecy
- Extreme Bandwidth
Star Topology
graph TD
1 --- n
2 --- n
3 --- n
4 --- n
5 --- n
6 --- n
7 --- n
8 --- n
9 --- n
All nodes connect to a central hub that distributes communications. This scales better but can be easily overwhelmed due to the single point of failure.
Tree
This is a collection of sub-networks that are joined by a central hub. This helps for communicating between neighbours quicker.
Mesh
This is a messy topology that has a number of connections between leaves. Generally the number of connections required is:
\[x-1\]
For a more stable network, the following number of connections is suggested:
\[x\log(x)\]
Internet Topology
There are a number of tiers with progressively reduced nodes. There are links between nodes in the same tiers and their children.
This is bad from a security standpoint as your message may have to travel through several third parties.
Layers
Refer to:
for the protocol layer structure.
For HTTPS over TCP over IP, the following is leaked:
- IP Addresses and ports of the sender & receiver.
- Target domain name.
- Size and time of the transfer.
- Information about the type of encryption used and certificates.
Only the body of an encrypted, with PGP, from the email server. In flight the email is encrypted using TLS. Thus, the following are leaked:
- Message time and size.
- Sender
- Receiver
- Subject
Sender and receiver could be hidden by using a service such as TOR.
We kill people based on metadata. - Michael Hayden (CIA, NSA Former Director)
CIA Triad (Our Goals)
- Confidentiality - Including company secrets and customer data.
- Integrity - Keep stored data correct.
- Availability - We should be able to provide the service.
Attacks
There are two general classifications of attacks:
Passive attacks require only observation from attackers:
- Message Interception
- Traffic Analysis
Active attacks require an attacker to do something:
- Masquerade
- Denial of Service
- Message Modification (or Deletion)
Types of Attackers
Different types of attacker have different goals, methods and resources:
Attacker |
Goal |
CIA Target |
Methods |
Resources |
Attack Types |
Bored Teenager |
lulz |
C, I & A |
Unintended use of public facing components. |
None |
Message interception, DOS. |
Malicious Customer |
Steal/Fraud |
- |
Misuse of procedures. |
None |
- |
Corporate Espionage |
Stealing secrets |
C |
Quiet gaining of login details or recruiting an insider. |
Considerable financial & technological. |
Interception |
Criminals |
Make money from you. |
C & A |
Social engineering or known bugs to gain data or threaten with downtime. |
Varies |
Message modification, DOS. |
Intelligence Service |
Learn about your customers or the products you are selling. |
C & I |
Supply chain attacks, side channel attacks, physical surveillance. |
All of them. |
Interception, modification and masquerade. |
Insider |
May be a combination of other types. |
- |
- |
Internal resources. |
- |
Mistakes |
Accidental impacts that should be mitigated. |
- |
- |
- |
- |
Threat Modelling
Severity
The severity of an attack is based on three factors:
- $f$ - How often the attack will happen?
- $p$ - How likely is the attack to succeed?
- $d$ - How damaging would the attack be?
Therefore we can calculate total severity by:
\[(f\times p)\times d\]
Damage
When determining damage, consider the following:
- Direct Damage:
- Loss of revenue when you shop is done.
- Compensation to affected customers.
- Loss of products to fraud.
- Reputational Damage
- Legal Issues:
- Loss of Competitive Advantage:
- Leaking of trade secrets.
- Loss of customer information.
Solution
After identifying an attack and determining its severity, choose a response:
- Prevent by taking measures that make the attack impossible.
- Mitigate by reducing the harm of the attack.
- Accept. Often after taking other actions.
Cost
Security measures come at a price:
- Financial cost.
- Slowing down work.
- Making things harder for your customers.
- Making work less pleasant for your employees.
If security measures are perceived as excessive, it greatly increases the risk of noncompliance.
Security Measures
We can take the following measures to enhance our security:
- Technology is necessary, but not sufficient:
- Rules and procedures are the best form of security.
- Follow relevant standards:
- NIST Cybersecurity Framework (US)
- Cyber Essentials (UK)
- PCI DSS (Card Payments)
- Insurance Standards
- Don’t have it:
- You can be less of a target if you don’t have the data (or access to it) to begin with.
- Need to know only:
- Anyone should only ever have access to what is essential.
- Access can be split into read, write and physical.
- The mind is weak:
- Rules should be written with humans in mind.
- Rules should be easy to follow and tolerant of failure.
- Trust no input:
- Always make sure that input is in the correct form before completing any sort of processing.
- Check and recover:
- Have procedures to detect data corruption.
- Always recover once corruption is detected.
- Get tested:
- Employ a pentester to check your work.
- Post bug bounties and react positively to found bugs to reduce the chance of people holding on to zero-days.
There are also some more rules for high security systems. They are often too onerous for typical systems:
- Air-gaps:
- You can only really be secure when you are not connected to the internet.
- A one-way network may be a reasonable solution for data monitoring.
- Procedures should be implemented for getting information across the gap safely.
- No device is secure:
- No device is acceptable in a high security environment, unless highly vetted.
Authentication
We can use the following factors to authenticate a user by:
- Something the user knows (also Something the user can do):
- By writing down a password you have it in multiple factors.
- Can be changed easily.
- Limits on what can be memorised.
- Hard to determine whether an attacker has it.
- Something the user has:
- Equivalent to a physical key.
- Generally an object that encodes a secret.
- Often combined with knowledge such as a pin or inherent like an image.
- Easy to change
- Easy to detect theft.
- Need to distribute the object.
- Something the user is - Inherent (also includes standard behaviour):
- Usually can’t be lost or forgotten.
- Hard to steal.
- Can’t be easily changed.
- Could change unexpectedly.
- Can be invasive.
- Somewhere the user is (Location):
- Can imply other authentication methods:
- If you are in the office, you must have already authenticated by another means.
- Low effort for the user.
- Off-site location can be faked.
- Not secure unless part of other factors.
Multi-Factor
In low security settings, one factor is often considered enough. However for:
- Accounts involving payments.
- Accounts for employees, where more information is available.
multiple factors should be mandatory.
Zero Knowledge Proofs
This type of cryptography allows a person to prove that they can do, or know, something without revealing the method or secret.
They typically follow a challenge response system:
- If you know secrets $s$, you will be able to solve problem $x$.
Cryptographic signing functions can be used with the challenge being the message to sign.
Attacks
Direct attacks on cryptographic algorithms are pretty much pointless. Hence, indirect attacks are usually more effective.
Implementation Weaknesses
- Nonces are reused.
- Random number generator is predictable.
- Implementation contains a bug.
Side-Channel Attacks
We can use data leaked into other channels to attack a system:
- Time or Power used.
- Keyboard sounds.
- Caching/Access Violations
Social Engineering & Rubber Hose
We can also manipulate people to give us the keys:
- Social engineering.
- Key-loggers
- Use of threats or violence.
Implementing Encryption
Use the following flowchart in an e-commerce situation:
graph TD
si[Should I create my own cryptography implementation?] --> no[No, never ever in a million years.]
Key Exchange
We can use public key encryption to share a secret, such as a symmetric key.
We can also use a pre-agreed key if we have a previous secure connection.
Diffie-Hellman (DH) Key Exchange
This is based on the assumption that logarithm modulo $n$ is not feasible to compute (like RSA).
The protocol to share a secret between Alice and Bob:
- Alice and Bob publicly agree no a large prime number $p$ and a number $x$ such that $\text{ord}(x)=p-1)$ in $(\mathbb Z/p\mathbb Z)^*$.
- Alice privately generates a secret number $a$ and computes $x^a\mod p$.
- Bob privately generates a secret number $b$ and computes $x^b\mod p$.
- Alice publicly sends $x^a$ to Bob and Bob publicly sends $x^b$ to Alice.
- Alice computes $s=(x^b)^a\mod p$.
- Bob computes $s=(x^a)^b\mod p$.
$s$ is now known to Alice and bob because $(x^a)^b=(x^b)^a$.
Hashing
Hashing is a non-reversable function to make a key from a binary blob. Usual conditions on a hashing function $h:X\rightarrow Y$:
- Efficiency
- Given $x$, it is feasible to compute $h(x)$.
- Secrecy
- Given $y=h(x)$, it is not feasible to compute any $z$ such $h(z)=y$.
- Collision
- It is not feasible to find any $x_1\neq x_2$ such that $h(x_1)=h(x_2)$.
We don’t require correctness as we don’t want to recover $x$.
Non-cryptographic hashes don’t require secrecy or collision.
Hashing Size
For a hash function, there is no requirement that the output is at least as long as the input:
- This way a very large $x$ can be turned into a pretty short hash.
Hashing Uses
Hashing is mainly used for:
- Message integrity checks.
- Password hashing.
Password Hashing
To store passwords for comparison purposes, it is most secure to:
- Generate a salt that is unique per user and service (not necessarily secret).
- When a user sets their password compute $y=h(\text{pwd}+\text{salt})$ and store only $y$ and $\text{salt}$.
- When a user wants to login compute $y’=h(x+\text{salt})$. If $y=y’$ then the password is correct.
Salting requires that passwords can only be attacked one at a time. You can’t find what a password is from other leaked tables or by matching to other users.
Hashing must be completed server-side as the server must receive a password. If not an attacker could steal the database and it is no more secure than just storing plan-text passwords.
We can double hash to mitigate this and never have the plan-text password in flight.
Precedence
You can use hashes to show presidency. You could say:
I know what the outcome of tomorrows football match. I won’t spoil it but this is the hash of my prediction.
You can also accomplish this with signing.
Cryptocurrency
With a hash function, it is hard to find $x$ such that $h(x)=y$.
Finding an approximation that:
\[h(x)\approx 0\]
is used as proof of work. This is also a difficult task to do.
Signing
We have the public key comprised of $e$ and the modulus $n$ and the private key $k$:
- To sign a message $x$ compute $s=x^k\mod n$
- Then post $x$ together with $s$.
- To verify the signature compute $s^e\mod n$. We now have $(x^k)^e=x\mod n$.
To sign faster we can compute a hash of the message. We can then sign this hash.
Authentication
By verifying the signature you can verify that the person who signed the message was in ownership of that private key.
You can also say that no-one has tampered with the document provided that they’re not in ownership of the private key.
Identity
You can prove your identity by signing a random message:
- You mustn’t sign a meaningful document if you only want to prove your identity.
We take the following method:
- Alice privately knows the private key $k$ and posts the public key $e,n$.
- Alice randomly generates a number $a$ and publicly sends it to bob.
- Bob randomly generates a number $b$ and publicly sends it to Bob.
- Alice computes $s=h(h(a)+h(b))^k\mod n$ and publicly sends it to Bob.
- Bob verifies that $s^e=h(h(a)+h(b))\mod n$.
Operating on Cipher-Text
Some operations are possible on the cipher-text without knowing the plain-text:
-
RSA allows multiplication modulo $n$:
Given cipher-text of $x,y$ we can compute $x\times y$ without knowing $x,y,k$.
This is why we need to hash the hashes of $a$ and $b$ for identity.
AES
AES has the following pros:
- Very fast to compute.
- Key size is very small for equivalent security (265 bits vs 4096 for RSA).
Due to it’s speed, AES is used under TLS for HTTPS.
Public key encryption is often used for key sharing in symmetric encryption systems (DH for TLS). This is due to the fact that symmetric keys can’t be shared in plaintext.
Quantum Computing
With quantum computing, solving asymmetric (public key) will become feasible. This includes RSA and elliptic curve encryption.
Existing symmetric encryption is believed to be as secure as with classical computers.
This is an issue as symmetric encryption often uses public key for sharing keys. Therefore existing communications could be decrypted.
Solutions
- Use quantum-proof cryptography.
- Use very large key-sizes.
- Think about how long something should remain secret.
Computing Keys
Take $p=7, q=11$.
- Therefore $n=pq=77$ and $m=(p-1)(q-1)=60$.
- Choose $e$ where $\text{gcd}(e, 60)=1$. $e=7$ works in this case.
- To compute $k=e^{-1}\mod 60$:
- $9\times7=63=3\mod60$.
-
\[\begin{aligned}
1&=7-2\times3\\
&=7-2\times(9\times7)\\
&=1-18)\times7\\
&=-17\times7\mod60
\end{aligned}\]
- Therefore $7^{-1}=-17=43\mod60$.
Encryption
Given that the public keys are $n=77,e=7$ and the private key is $k=43$, we wish to encrypt $x=3$:
- Calculate $x^e\mod 77$.
- This equals 31.
We can reduce the number of multiplications in the exponent by halving the power:
\[\begin{aligned}
c&=3^7\mod n\\
&=3^3\times3^3\times^1\mod 77
\end{aligned}\]
Decryption
\[x=c^k\mod n\]
One-time Pads
This method of encryption provides perfect secrecy provided that the following are met:
- The key should never be reused.
- The key needs to be at least as long as the message:
- If a longer key is used then the message should be padded.
- You have a perfect source of randomness to generate the keys.
Encryption and decryption is completed by:
- XORing the key with the message.
It is ideal in a scenario where you have:
- A slow secure channel to transfer keys in advance.
- A fast insecure channel where you can send your encrypted messages.
This method is too inconvenient to use in e-commerce.
RSA
RSA relies on the following functions:
- Public key generation function
keygen
: $K \rightarrow L$
- Encryption function
enc
: $X\times L\rightarrow Y$
- Decryption function
dec
: $Y\times K\rightarrow X$
It also requires that the following are true:
- Correctness -
dec(end(x, keygen(k)), k)=x
for every $x\in X$ and $k\in K$.
- Efficiency - Given $k$ and $x$, it is feasible to compute
keygen(k)
, enc(x, keygen(k))
and dec(enc(x, keygen(k)), k)
.
- Key Secrecy - Given
l = keygen(k)
and multiple encoded messages using that public key, it is not feasible to compute any of the messages.
Groups
In algebra a group is a pair $(G, \cdot)$ where $G$ is a set and $\cdot:G\times G\rightarrow G$ is an operator with the following properties:
- Identity
- There is an identity element $\mathbf 1\in G$ such that $\mathbf1\cdot x=x\cdot\mathbf1=x$ for every $x\in G$.
- Inverse
- For every $x\in G$ there is a $x^{-1}\in G$ such that $x\cdot x:^{-1}=x^{-1}\cdot x=\mathbf 1$.
- Associative
- $(x\cdot y)\cdot z=x\cdot(y\cdot z)$ for every $x,y,z\in G$.
Additionally, a group is finite if the set $G$ is finite.
Example Finite Group
Consider the following finite group that is used in RSA:
\[((\mathbb Z/n\mathbb Z)^*,\times)\]
This is the group of integers modulo $n$ (except those $x$ where $\text{gcd}(n,x)>1$).
The identity and associative properties for this group are equal to multiplication, however the inverse is calculated differently:
Take any $x\in(\mathbb Z/n\mathbb Z)^*$, we will show that $x$ has an inverse:
-
We want to show that there is some $z\in (\mathbb Z/n\mathbb Z)^*$ such that $xz=1$.
$z$ is the inverse.
-
We can test the inverse if the following holds:
\[xz=1\mod n\]
Computing $x^{-1}\mod n$ take logarithmic time with respect to $x$ and $n$. This makes it quite feasible for large numbers on modern hardware.
Order
Let $(G,\cdot)$ be a finite group, and $x\in G$. The order of $x$, denoted by $\text{ord}(x)$, is the lowest number $i$ such that $x^i=\mathbf 1$.
This power is at most $m$ where $m=\left\vert G\right\vert$.
Lagrange’s Theorem
Let $(G,\cdot)$ be a finite group. Take any $x\in G$ and let $m=\mid G\mid$. Then $\text{ord}(x)$ divides $\mid G\mid$.#
This is to prove that:
If we know $\mid G\mid$, we can easily compute $k=e^{-1}$ and therefore $e\times k=1\mod\mid G\mid$.
Therefore $(x^e)^k=x^{e\times k}=x$.
However, for this to be the case we need to know $\mid G\mid$ (we can use this as a key to encrypt $x$).
RSA Group Size
The group used in RSA, $(\mathbb Z /n\mathbb Z)^*$, where $n$ is the product of two large primes $p,q$. To calculate the group size:
- There are $n$ numbers in the group $(\mathbb Z /n\mathbb Z)^*$
- We must exclude every number $x$ such that k$\text{gcd}(x,n)\neq 1$.
- …
- In total there are $p\times q-p+1$ elements, which is equal to $(p-1)(q-1)$.
RSA Description
Key Generation:
- Find two large prime numbers $p$ and $q$.
- Compute $n=pq$ and $m=(p-1)(q-1)$.
- Find $e$ such that $gcd(e,m)=1$ and take $k=e^{-1}\mod m$.
- The public keys are $n$ and $e$. The private key is $k$.
Encryption:
- For plaintext $x$ compute the ciphertext $y=x^e\mod n$.
- A large message $x$ may need to be split into several smaller messages.
Decryption:
- For cipher text $y$, compute the plaintext $y^k\mod n$.
Public Key Encryption Issues
- You must gain a third party’s key in order to send a message to them.
- You must also trust that the key is their’s and not an attacker’s.
- Public key cryptography is slower than symmetric key.
- Very large keys are required for good security (4096 bit).
Public Key Encryption Strengths
- With large keys, RSA is pretty much invulnerable to brute force, known plaintext and chosen plaintext attacks.
- Similar plaintexts product very different cyphertexts.
- Public key distributions is much easier as it can be asynchronous.
Issues that encryption aims to solve:
- Incorrect relaying of information.
- This has partial solutions.
- Eavesdropping on information.
Solutions to Eavesdropping
- Control your environment such that there is no possibility of eavesdropping.
- Use a different language.
- Speak in code (using different keywords to create plausible deniability).
Solutions for Written Text
- Sealing the message using a seal (not suitable for electronic communications).
- Prevent messages being read by non-recipients:
Steganography
This is the hiding of messages in non-secret messages.
- Hide information in the least significant bits of an image or audio file.
Obscurity
Hiding the message is just security through obscurity:
- This is not suitable for e-commerce.
Cryptography
Historical encryption schemes usually fall into two categories:
-
Transposition - change the order and location of symbols.
This technique is not used in modern methods as it often has significant redundant data and involves moving the letters physically.
-
Substitution - replace symbols by other symbols.
Transposition
Scytale
- Make two sticks with the same diameter:
- One for sender, one for receiver.
- To encrypt - wrap the strip of paper around the stick and write on surfaces next to each other:
- Fill other surfaces with random letters or place multiple messages at different starting points.
- To decrypt - wrap the strip of paper around the stick and read the surfaces next to each-other.
Grille
Similar to Scytale:
- Cut pieces out of paper, making two copies:
- One for sender and receiver.
- Encrypt by placing the paper with holes on top of the empty paper and write on exposed surfaces.
- Continue on open spaces or fill with random letters.
- Decrypt by placing the holes on top of the message and reading the correct letters.
Substitution
Caesar Cipher
- Replace every letter by the same letter shifted by $n$.
This has the following weaknesses:
- Brute-force as there are only 26 encryption keys.
- Known plain-text attack if you know one plain-text, cipher-text, pair then you can find the key.
- Chosen plain-text attack if you can trick the key-holder to encrypt plain-text of your choosing.
- Cipher-text only attack by using frequency analysis.
Even if you can’t decrypt it you can still see the following:
- Length of the message:
- Can be avoided if you use padding.
- You will always know an upper-bound message of the length even with padding.
- Similar plain-text gives similar cipher-text.
Mono-alphabetic Ciphers
This method replaces every letter with some other letter.
The benefit over Caesar cipher is that:
Polygraphic/alphabetic Ciphers
- Polygraphic Cipher
- Operate on groups of symbols.
- Polyalphabetic Ciphers
- May encrypt one (group of) symbol(s) into multiple different ones.
Polygraphic Cipher
They encrypt groups of symbols like so:
Each grouping of two letter maps onto:
- Different groups of 2 letter.
- A dedicated symbol
The key size for a cipher with group size $n$ is:
\[26^n\]
as opposed to 26 for mono-alphabetic.
Compared to the previous ciphers:
- Less vulnerable to known plain-text attack.
- Significantly less vulnerable to cipher text only attacks.
- Less vulnerable to brute force.
- Far more inconvenient.
Many current encryption schemes can be classed as polygraphic ciphers. With RSA $n>512$.
Polyalphabetic Ciphers
Replace one symbol by one other symbol, but not always the same one (like multiple mono-alphabetic ciphers at the same time).
You can create a password by using 26 preset alphabets (schema). The password of length 26 then indicates where to start on each line.
Vignère cipher is an example of this where 26 Caesar ciphers are used in order.
Compared to previous ciphers:
- Brute force is not feasible.
- Known plain-text is somewhat vulnerable.
- Vulnerable to chosen plain-text.
- Practically invulnerable to frequency analysis.
To be secure we need to change the password often otherwise the scheme is only as secure as the key-length of the password.
One-on-one Negotiations
This is hard to do automatically, but often useful for relatively high value items.
Fixed Prices (Your Choice)
Set prices the way you want. Some analysis of price elasticity and competition will be needed.
Fixed Prices (Not Your Choice)
Some times you have to accept others setting the price for you.
Dynamic Prices
You can use bots to automatically set your prices to increase or decrease depending on:
- Normal Auction
- one seller, multiple buyers.
- Reverse Auction
- multiple sellers, one buyer.
- Double Auction
- Multiple sellers, multiple buyers.
Reverse Auctions
Reverse auctions are the same as standard auctions however the sellers bid down against each-other.
Think about companies bidding to complete a government contract for the cheapest.
- The price direction is reversed.
- The sellers bid for the buyer.
- Social welfare is maximised if the seller who values the item the least wins the auction.
Reverse English Auction
- Buyer sets a reserve price.
- Sellers can bid below the standing bid.
- Auction ends when no bidder is willing to lower the price or when time runs out.
- The lowest bidder wins.
Reverse Japanese Auction
- Buyer sets a reserve price.
- All potential sellers must announce their participation.
- Price decreases at predictable intervals.
- Winner is the last remaining seller once all other’s have dropped out.
Double Auctions
These auctions are often used for energy markets and therefore often trade in high value.
There is only one generally accepted method for a double auction:
- There are $n$ buyers $b_n$ and $n$ sellers $s_n$.
-
You bid for a number of items and a price per item to be bought or sold.
Suppose you decided on a price of £0. Then lots of buyers would be willing to pay but no seller would be willing to sell.
- If we increase the price, the number of buyers will decrease and the number of sellers will increase.
- If we decrease the opposite will happen.
We should aim between these prices and aim for maximum units sold.
Double Auction Theoretical Properties
There is no double auction that satisfies:
- Truthfulness
- Social Welfare
Alternative to Double Auctions
Some alternatives to double auctions are:
- Multiple parallel auctions.
- Multiple parallel reverse auctions.
This is often more understandable and is used in consumer facing applications.
This has the side-effect of being truthful and maximising social welfare for the buyers/sellers if you choose the appropriate model:
- You can’t have both buyers and sellers being honest at the same time.
Several people may want to cheat in an acution:
Sometimes the seller is also the auctioneer.
Second Price Sealed Bid Cheating
Consider the following cheats:
- The auctioneer could drive up the price by faking a higher second bid.
- The seller could drive up the price by bidder themselves, an amount they expect to be second.
- Multiple bidders could collude by asking other to lower their bid.
Additionally anyone could bribe anyone else to complete these actions.
First Price Sealed Bid Cheating
With this types of auction, neither the auctioneer nor seller can drive up the price.
- Some bidders could try to bribe the auctioneer.
This method is overall more resistant to cheating.
Other Factors
People may change the way they bid based on the following factors:
- Expected price.
- Possibility of cheating.
and more:
Synchrony
Some autions require all participants to be present at the same time:
Synchronous:
- Japanese Auction
- Dutch Auction
- Some kinds of English auction
Asynchronous:
- Sealed Bid
- Other kinds of English auction
In e-commerce, asynchronous auctions are easier to implement.
Time
Some auctions take longer than others:
Type |
Time |
Dutch |
Famously quick. |
Japanese |
Can be quick. |
English |
Rather slow. |
Sealed Bid |
Variable but tend to be longer. |
Trust
Auctions work better if the auctioneer is trusted:
- The auction should be transparent and simple.
-
The implementation should not hide too much from the bidders.
For example the auctioneer could read all the prices in a sealed bid auction, instead of just saying who won.
During the auction, you may learn more about the item’s value:
- Ideal agents are not affected as they know the item’s worth.
- Realistic agents may have their value influenced by the current bid.
Irrational Bids
Some auctions types can promote the following:
Irrationally High Bids
English auctions are good at making people overbid due to:
- Small increase increments (making it feel like you’re spending less).
- Easy to underestimate other bidder’s willingness to raise.
All-pay auctions also promote overbidding.
Irrationally Low Bids
Second-price sealed bid:
- You should bid your value instead of what you hope to pay.
Inexperienced buyers tend to bid lower than their value.
Notes on these Factors
The importance of each factor depends on what is being sold and to whom:
- Time is more important for relatively low value auction.
- Synchrony is generally less of an issue for high value items.
- Irrationality and complexity are less important in B2B as you are likely to have trained bidders.
Social Welfare
Commerce is about distributing resources in such a way where everyone is better off after each transaction.
The goal is to maximise social welfare. This is controversial as no-one wants to have less money (rich or poor).
- Maximising Social Welfare
- An auction protocol maximises social welfare if whenever all bidders are rational, the item is guaranteed to end up with the person who values it the most.
- Rational Bidder
- A person who plays an optimal strategy if it exists, otherwise a rationalisable strategy.
It may be the case that the item is not sold as the seller values it more than any buyer.
Limitations of Social Welfare
It is unfortunate that if someone pays more for an item, this maximises social welfare. This leads to poor people unable to get what they need if a rich person can pay more.
We can respond in several ways:
- Evil - Bidder 2 is willing to pay more, so bidder 1 should starve.
- Reasonable - Bidder 1’s inability to pay for food is a societal problem and should be solved by government.
- Pragmatic - Social welfare is not a perfect measure, but it is good enough to be useful.
Truthfulness
To find the value of an item, we ask the bidders their valuation:
The bidder may lie to optimise their profits.
A truthful auction is one where a bidder is forced to bid their valuation of the item in an optimal strategy.
In this case it is easy to optimise social welfare.
A bid is truthful:
- If the amount you bid is equal to your value for the item.
An auction is truthful:
- If bidding truthfully is always (one of) the optimal strategy/ies.
Auction Properties
Auction Type |
Max Social Welfare |
Truthful |
English (with minimum) |
0 |
0 |
English (without minimum) |
~ |
~ |
Japanese |
1 |
1 |
Dutch |
0 |
0 |
First-price Sealed |
0 |
0 |
Second-price Sealed |
1 |
1 |
Deterministic All-pay |
0 |
0 |
Non-deterministic All-pay |
0 |
0 |
It should be common knowledge that all participants are rational for this to be true.
English without minimum increase is generally not truthful or maximising social welfare. However, you can derive the participants valuation from their strategy.
- If an auction if truthful then it maximises social welfare.
Sealed Bid Auction Strategy
You should bid:
You can also play mind games to make your opponents think you have a lower value of the item. This way they will bid lower in response.
- Every bid below $v$ is rationalisable.
Second Bid Sealed Auction Strategy
You should:
In this case you will pay the next valuation lower ($t$) than $v$ and you will make at least zero profit.
Japanese Auction Strategy
You should always drop out when the auction hits your value $v$.
Deterministic All Pay Sealed Bid Auction Strategy
- Any bid below the valuation $v$ is rationalisable.
With rational bidders the seller can expect to receive the value of the item in payouts, despite all paying:
- In reality most people overbid.
Deterministic All Pay English Auction Strategy
The dollar auction is the best known example of this type:
- The item to be sold is one dollar.
Assume a minimum increase of 40¢:
-
It is rationalisable to bid infinitely, provided that the bid improves the marginal.
The marginal is the difference in profit from the last bid.
Rationality doesn’t guarantee a good outcome. You can gain arbitrarily high losses in an auction of this type.
Non-deterministic All Pay Auction Strategy
The expected outcome in a lottery for all players, including the seller, is zero.
Generally this is not the case as the seller takes a profit by giving prizes worth less than the sum of the tickets.
In practice, some money can be made from irrationality.
A strategy is a description of how the bidder will behave in every possible situation.
Best Response
Suppose there are $n$ bidders using strategies $s_1,\ldots, s_n$ where you are bidder 1:
- The outcome of the auction when everyone uses that strategy can be computed.
- We can call the outcome $O(s_1,\ldots, s_n)$
- Your strategy $s_1$ is a best response to $s_2, \ldots, s_n$ if there is no $s’_1$ such that $O(s’_1,\ldots, s_n)$ is better for you than $O(s_1,\ldots, s_n)$.
This model doesn’t account for people who change their strategies.
If $sj_1$ is the best response to $s_2,\ldots, s_n$, then other might play different strategies $s’_2, \ldots, s’_n$ if you use $s_1$.
Rationalisability
A strategy $s_1$ is rationalisable if:
- There are strategies $s_2, \ldots, s_n$ that $s_1$ is best response to.
- $s_2, \ldots, s_n$ are rationalisable.
Therefore, everyone is playing the best response at least one other person’s strategy, given that everyone is playing a rationalisable strategy.
Not every rationalisable strategy is optimal.
Optimality
A strategy $s_1$ is optimal if it is the best response to every choice of strategies $s_2, \ldots, s_n$ of other bidders:
- If an optimal strategy exists you should use it.
- Otherwise default to a rationalisable one.
Every optimal strategy is rationalisable.
English Auction Strategy
Consider we are in an English auction with the following assumptions:
- Suppose that the current standing bid $b_2$ by the other bidder and $b_2<v_1$.
-
Raise with the following inequality:
\[b_2<b_1<v_1\]
where $b_1$ is your new bid.
You can never be certain what your opponent will do. Therefore you must follow these rules as you can’t be sure whether you will be outbid or not.
English Auctions with Minimum Increase
You can make use of the minimum raise to increase your profit:
- Consider that you know your competitor values the item at £100 and you at £150. There is a minimum raise of £10.
- If you are able to bit £91 then the other bidder can no longer raise. Therefore you have a profit of £150 - £91 = £59.
Before we would have only gained a profit of £40. By getting the bid right we can increase profit by up to twice the minimum raise.
If your information is false then you can end up making a reduced profit by raising too quickly.
We can derive how much an item is worth in commerce by using the following methods:
|
One Buyer |
Multiple Buyers |
One Seller |
Negotiation |
Auction |
Multiple Sellers |
Reverse Auction |
Market/Double Auction |
Auction Types & Strategy
There are several types of auction that are available:
English Auction
- Auctioneer announces an initial standing bid (often the reserve price).
-
Each bidder may increase the standing bid by calling out a higher price.
Usually there is a minimum increase.
- Bidding end at a specified time, or when no one wants to increase the standing bid.
- Item is sold to the highest bidder, at the price they bid.
Japanese Auction
- All bidders must announce their entry into the auction.
- The auctioneer announces an initial price.
- The price increases at a set rate (e.g. £1 per 5 seconds).
- Bidders can leave the auction at any time. Once you leave, you can’t re-enter.
- This continues until only one buyer is left.
- The item is sold to the last remaining bidder, at the price the last other bidder left.
Dutch Auction
Similar to Japanese auctions, except the price decreases over time.
- The price starts high.
- The price decreases over time.
- At any time a bidder can pay the current price.
- The auction ends once the first bid is made.
Sealed-bid Auction
First Price
Bids are made in secret:
- Every bidder writes down their bid and submits it i a sealed envelope.
- Once all bids are in, the auctioneer reads all the bids.
- The item is sold to the highest bidder.
Second Price
The is the same as first price except:
- The item is sold to the highest bidder, for the price of the second highest bid.
All-pay Auction
This type is rarely used in practice.
Deterministic
- Complete an English or sealed bid auction.
- Highest bidder wins.
- Every bidder must pay their bid regardless of whether they win.
Non-deterministic
- Complete an English or sealed bid auction.
- Winner is chosen randomly, weighted by their bid.
- Every bidder must pay their bid, regardless of whether they win.
This is also known as a lottery.
Other Auction Types
There are also other types of auction for selling multiple copies of an item:
Strategy, Operations & Tactics
These are in the following hierarchy:
They apply to the following analogy:
graph LR
Strategy <--> bm[Business Model]
Operations <--> td[Technology Decisions]
Tactics <--> Programming
This is to say that technology and programming both serve the business model.
Build, Buy or Rent
When deciding whether to make any technology for e-commerce consider the following flowchart:
flowchart TD
subgraph Should I design my own e-commerce software?
hb[How big is your company] -->|huge| yc[Your choice]
hb -->|large| uf[Do you need usual features]
uf -->|yes| ue[Try to use existing solutions as far<br>as possible, but modify as needed.]
uf -->|no| tm
hb -->|small| tm[No. At most, make some tiny<br>modifications to an existing solution.]
end
Designing your own e-commerce is generally a bad idea.
Available Options for Buy & Rent
- You could sell on an existing platform, like Amazon.
- Reliable and convenient, but the platform will take a fee.
- You could purchase or rent a licence to an existing package.
- More flexible than using an existing platform, but can be costly.
- You could use (and possibly adapt) an open source platform.
- Great flexibility, but requires more work and expertise than other options.
Value Proposition
What do you deliver that is perceived to be of value to your customers?
You may choose something that provides no value in order to scam people.
- Revenue Model
- Who will pay you?
- Market Situation
- Who are your competitors? What advantage to you have over them? How big is the market for your product? How will you attract your audience?
- Organisation
- Who will work for your company and how will they be organised?
There are two considerations to be aware in an e-commerce value proposition:
- Does your value lie in the service you offer, or in how you offer it?
- What does being e-commerce add?
Revenue Model
There are several types of revenue model:
Type |
Description |
Sales Model |
You get money for selling stuff. |
Transaction Fee Model |
You get paid for selling other people’s stuff. |
Subscription Model |
Customers pay a fixed fee for your service. |
Freemium Model |
Basic service is provided for free. Higher tiers use other service models. |
Advertising Model |
Sell advertisements that are shown to your customers. |
Data Broker Model |
You sell access to information about your customers - dangerous. |
Affiliate Model |
You get paid for sending customers to someone else. |
Donation Model |
Get paid by voluntary donations from customers - risky. |
Some services use a combination, or other, models such as:
- The Guardian:
- Uses advertising and donation online.
- Uses a subscription model for print.
Market Situation
- How big is the market you are trying to capture?
-
What competition do you have?
Includes both direct competition for the same service, and indirect for substitutes. Uber has direct competition from Lyft, indirect from black cabs and public transport.
- What advantages/disadvantages do you have compared to the competition?
- Will you have issues with regulation?
Organisation
- What is your company attitude?
- What is your approach to recruitment?
Uber Case Study
-
What value does Uber offer?
Immediate rides through your phone.
-
Where does Uber derive its revenue from?
- Subscription with Uber one.
- Transactional fee to setup a driver and customer.
-
What competition does Uber face?
- Black cabs.
- Conventional taxis.
- Public transport.
- Personal transport.
-
How does Uber’s company structure work?
The drivers are not employees.
-
Does Uber face any regulatory threats?
Treatment of workforce. Employees or contractors?
-
Have the answer to any of these questions changed over time?
Yes, subscription is added. Competition has increased in addition to regulation.
YouTuber Case Study
- What value do YouTubers offer?
- Where do YouTubers derive their revenue from?
- What competition do YouTubers face?
- How do YouTubers’ company structures work?
- Do YouTubers face any regulatory threats?
- Have the answer to any of these questions changed over time?
Some businesses may use a combination of the following (such as eBay):
B2B
In B2B e-commerce, seller and buyer are both businesses. Take the following examples:
- Office supply vendor (physical goods).
- Cloud service provider (IT service).
- PR management (service).
This is by far the largest market segment.
B2C
Business sells to customer:
- Ordering food from Tesco online.
- Amazon
C2C
Customer sells to customer, often with a business as an intermediary:
C2B
Customer sells to a business such as:
- SurveyMoney (labour for money)
- Amazon Mechanical Turk (human computation)
- CeX (sell to a business)
This is by far the smallest segment.
What is Commerce
- Commerce
- is a transaction between two or more parties, in which something is exchanged and each party hopes to benefit.
- Party
- A party in commerce may be an individual or organisation.
- Things
- Things are goods (including money) or services (tangible or intangible).
E-Commerce
- E-Commerce
- Commerce that is conducted (at least partially) on the internet.
The following grid may help in determining e-commerce:
|
eBay |
GrubHub |
App |
Kiosk |
Card |
Negotate |
1 |
0 |
0 |
0 |
0 |
Store Customer Info |
1 |
1 |
? |
0 |
0 |
Process Orders |
1 |
1 |
1 |
1 |
0 |
Process Payments |
1 |
1 |
1 |
1 |
1 |
E-Business
Laudon and Traver say that:
E-buisness is within one organisation, while e-commerce is between different organisations.
Homework
- Think of a few existing companies that are clearly doing e-commerce.
- Think of a few existing companies that are clearly not doing e-commerce.
- Think of a few existing companies that are arguably doing e-commerce.
For each example: consider whether they need to negotiate, store customer information, process orders and process payments.