Cyber_security

PGP

digital signatures

sender 用一个cryptographic function(比如SHA-256)来计算发送信息的hash(digest),这个hash表示的message是独一无二的,定长的。再使用sender自己的private key使用 asymmetric algorithm (比如RSA/DSA)对这个hash进行签名, recipient 再用sender的public key进行验证。

message encryption / confidentiality

PGP 使用hybird encryption(混合加密), symmetric encryption(对称加密) 用于encrypt实际信息, asymmetric encryption(非对称加密) 用于加密session key和digital signatures.

完整步骤

PGP Services

confidentiality only

If you only use PGP to encrypt your information (confidentiality(保密性)), you protect the message from unauthorized access, but you do not guarantee its integrity(完整性).

Z/Z-1: 压缩和解压操作。PGP在加密前对信息进行压缩,以节省空间和减少传输时间。
EC/DC: 对称密钥的加密和解密操作。这些操作是使用会话密钥进行的。
EP/DP: 公钥加密和解密操作。这些操作使用收件人的公共和私人密钥进行。
‘||’: 连接,即把两个或多个数据连接在一起。
综上所述,描述了PGP如何通过用对称会话密钥加密信息内容,然后用收件人的公开密钥加密会话密钥来为信息提供保密性。这个过程不涉及数字签名或消息认证和完整性检查。

Confidentiality and Authentication

Authentication(digital signatures(数字签名)),就可以保证了integrity(完整性)。

PGP Message Format

  1. Session key component: 该组件包含会话密钥和发件人用于加密会话密钥的收件人公钥的标识符。会话密钥是为每条信息生成的唯一的、一次性的密钥,用于使用对称加密算法(如AES)对信息内容进行加密。为了安全地将会话密钥传输给收件人,发件人使用收件人的公钥和非对称加密算法(如RSA)对其进行加密。包括收件人公钥的标识符,确保收件人知道他们的公钥中哪一个被使用,以防他们有多个公钥。
  2. Message component: 该组件包含要传输的实际数据,使用会话密钥进行加密。除了加密的信息内容外,信息组件还包括元数据,如文件名和指定信息创建时间的时间戳。文件名可以帮助收件人了解消息的背景或目的,而时间戳则有助于跟踪消息的年龄并确保其相关性。
  3. Signature component: Timestamp(时间戳)目的是产生签名时间。Message digest(信息摘要),结合签名时间,可以用来验证消息的完整性。
  4. 前两个字节: 当收件人使用发件人的公钥对信息摘要(数字签名)进行解密时,他们将获得信息内容的原始哈希值和签名的时间戳。然后,他们可以将这个解密的哈希值的前两个字节与包含在签名组件中的消息摘要的前两个字节的明文副本进行比较。
    如果这前两个字节相匹配,就表明解密时使用了正确的公钥,并且该信息被认为是真实的。然后,收件人可以继续对收到的消息内容结合签名时间戳生成一个新的哈希值,并将其与解密后的哈希值进行比较。如果两个哈希值相匹配,就可以确认该消息在传输过程中没有被篡改,可以安全使用。
    通过这种方式,PGP消息格式确保了消息的认证和完整性,使收件人可以验证发件人的身份和消息的完整性。

key rings

PGP使用key rings来存储公钥和私钥。key rings是一个文件,包含了公钥和私钥。key rings可以分为两类:public key rings和private key rings。public key rings包含了公钥,private key rings包含了私钥。 sender 和 recipients 都有自己的key rings。

key identifiers (key ID)

recipients 怎么知道一条接受的message是用哪个public key?

  1. message和public key同时发送给recipients
  2. 使用key identifier 去识别一个public key特别是在key server上的。

PGP 使用后者,UserID x key ID。key ID 是public key的hash,用来识别public key。ie. KeyID = $KU_a mod 2^{64}$. 私钥(KR),公钥(KU), 特定用户a,所以KU_a指的是用户a的公钥。这句话的意思是指就指计算一个private key的时候,应该使用用户KU中最没有意义的64位。

A private-key ring to store the private/public key pairs owned
by this user.
A public-key ring to store the public keys of other users known
to this user.

Both key rings can be indexed by either User ID or Key ID.

encryption private key

encencrypted private key = $EC_{H(Pi)}[PR_i]$

$PR_i$ : User i’s private key

CAST-128(C): A symmetric algorithm

Key-encryption key: 用于加密User’s private key($PR_i$)的key,是由用户选择的passphrase(口令): $Pi$生成的。

Passphrase(口令 Pi): 类似于密码,但是比密码更长,更复杂。每一个private key应该有与之对应的一个passphrase。

Hash function(H): 输入Passphrase(Pi),输出一个hash code(H),这个hash code(H)用于求出key-encryption key。

encryption process(E): 加密过程

private-key rings

pairs : {private key : public key}

有点类似于windows,每一行就是windows的一个user,我可以有多个user。

Timestep 是创建这个用户的时间。

PGP Trust Model

Web-of-Trust

Owner Trust: PGP user 信任key’s owner to sign public-key certificates(public key签署的公共密钥证书的信任程度).
e.g.

  • ounknown user
  • opartially trusted user
  • ofully trusted user

Signature Trust: 证书的签名者(certificate signer)对用户身份的信任程度。这个值在key server(钥匙服务器)与certificate signed 一起公开。比如Ailice signs(certifies) Bob‘s key,也就是她生命信任Bob的身份。

Key Legitimacy: 该PGP用户对public key的拥有者的身份的信任程度。至少有一个Signature fully trusted , 或者两个Signature partially trusted.

Public key revocation(公钥废止)

  1. 与公钥相关的私钥被破坏
  2. 所有者不再需要该证书

这个步骤是右所有者发出一个废止证书(revocation certificate)。这个证书中包含着public key to be revoked,和private key’s signature.

Generation of the signature component

  1. Signing a message : sender 决定使用PGP对信息进行签名从而提供Authenticity 和 integrity.
  2. Retrieving the sender’s private key: sender 从key ring中找到自己的private key.
  3. prompting for passpharse: sender 输入passphrase,用于解密private key.
  4. constructing the signature component: 在private key 被解密之后,PGP会结合message’s content生成一个signature component。然后这个签名会被添加到信息之中。
  5. recipient 收到信息之后,可以用签名和public key来验证信息完整性切没有被修改,和确实来自用户ID这个人。

generation of the session key component

  1. generating a session key: sender 生成一个session key,用于加密信息。
  2. encrypting the Message: sender 用session key加密信息。
  3. retrieving the recipient’s public key: sender 从key ring中通过User ID 作为index来找到recipient的public key。
  4. constructing the session key component: PGP 对session key进行加密。
  5. recipient 收到的message由两部分组成,session key component(使用recipient的public key加密的) 和 加密信息本身。
  6. recipient 用自己的private key解密session key component,然后用session key解密信息本身。

Exercise Question – E10.1

In secure email systems, such as PGP (pretty good privacy), the order
of message protection operations performed by a sending entity is to
first sign the outgoing/email message, then compress the signed
message, and finally encrypt the compressed message. Answer the
following questions:

(i) What are the justifications (or benefits) for using this order of
operations?

(ii) Would this order of operations be suitable for all cases of
applications?

(iii) Assuming that Alice sends Bob an email, M. Express the whole
message that is sent by Alice using protocol notation format?

  1. Signature verification can only be carried out after two decryption
    operations and this makes the solution vulnerable to DoS attacks.
    However, as this is an end user to end user communication at the
    application level, so the issue of DoS attacks is considered not as
    important as users’ preference of record-keeping a signed email (on
    plaintext). Compression-then-encryption can bring two benefits, one is
    security (harder to break a text that is not recognisible) and the other is
    performance (cheaper to encrypt a shorter message)

Software security (Malware)

Viruses(病毒)

Viruses Classifications(病毒分类)

Classification by concealment strategy(隐蔽性策略分类)

  1. Polymorphic virus(多态性病毒): changees its appearance, control flow or other characteristics 当infects a new host.
  2. Metamorphic virus(变态病毒): 更牛逼,传播的时候还改变了自己的代码,不仅改变了外观,还改变了行为。

Classification by target(目标分类)

  1. Boot sector viruses: infects the boot sector of a disk.(这个区域是包含计算机启动时候执行的代码的区域。感染后,可以确保病毒开机自动加载和执行,并将自己传递到其他磁盘上)
  2. File viruses: 针对executable file(可执行文件),比如.exe,.bat.感染文件被执行,病毒被执行。
  3. Multipartitle virusees: 前两者结合起来。
  4. Macro viruses: 利用Word 和 Excel等的内置编程语言。感染后,会在打开文档的时候执行病毒代码。
  5. scripting viruses: JS或者VB,网页或者电子邮件附件上。

structrure of a virus(病毒结构)

Propagation(传播)

将病毒从一个系统传播到另一个系统,过程通常需要人为干预,打开垃圾邮件,非正规网站下载资源。

Triggering(触发)

导致病毒执行的事件,比如打开文件,启动计算机,或者特定的日期。

Payload(载荷)

病毒的主要功能,比如delete files,steal information, encrypting data(赎金软件)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Virus() {
infectExecutable();
if (triggered()) {
doDamage();
}
jump to main of infected program;
}
void infectExecutable() {
file = choose an uninfected executable
file;
prepend/postpend/embed V to file;
}
void doDamage() { ... }
int triggered() { return (some test? 1 : 0); }

Worms(蠕虫)

与病毒的区别是,不需要人的互动,通过软件或者服务器漏洞传播。

Target Discovery

  1. Port scanning(端口扫描): 扫描网络上的所有端口,找到开放的端口,然后尝试连接,如果连接成功,就可以传播。
  2. External hit-list: 通过外部来源(meta-servers)获得有可能被感染的目标列表。
  3. Internal topological information : 已经感染的受害者及其上发现更多的目标主机。比如硬盘存的url,电子邮件。
  4. local subnet address structure : 如果Worm已经渗透到了防火墙内部,他就可以感染子网中其他的主机。

Propagation (传播)

  1. Exploiting communitcation/networking facilities or services(利用通信网络设施/服务): 比如利用邮件,RPC(远程程序调用)。
  2. Exploiting vulnerabilities or bugs in operating system(操作系统漏洞): 比如buffer overflow, code injection, SQL injection.
  3. Taking advantage of mobile code characteristics(利用移动代码的特点): 电子邮件附件,互动,动态内容。
  4. Insecured file sharing facilities.(不安全的文件共享设施)。

Activation and Payload

  1. Activation(激活): 打开电子邮件附件,点击网络链接。分为Human activity-based activation, Human activation, Scheduled process activation, self-activation.
  2. Payload: worm被激活开始工作,比如Dos(as a botnet),Data theft,Data integrity attack。

其他种类

  1. Trapdoor (backdoor 后门): developers for maintenance or testing purpose or maliciously inserted by attackers.
  2. Trojan horse (木马): 伪装成正常程序,但是实际上是恶意程序。
  3. Malicious Mobile Code(恶性移动代码): 从远程主机传送到本机。
  4. Zombies(bots僵尸): 被攻击者控制的主机,用来进行DDoS(分布式拒绝服务攻击) DDos 有一个Botnet,但DOS没有因为只是一个bot。
  5. Blended Attacks: 混合式攻击是指采用多种感染和/或传输方法来破坏系统或网络的恶意活动。

APTS(Advanced Persistent Threats 高级持续性威胁)

  1. Crimeware toolkits(犯罪软件包): APT攻击者通常使用软件包。没啥好说的,任何人都用。
  2. Persistence and stealth(持续性和隐蔽性); 攻击者渗透到目标网络之中并很长时间不被发现。
  3. Organized and dangerous attack source: 有组织的危险和攻击来源,从以前为了装逼的个人或者小团地转变成了正式的攻击组织/国家。
  4. Targeted attacks: APTs通常具有高度的针对性,比如国防,政府,金融。

Buffer Overflow

buffer是一个pre-allocated data storage area in computer’s memory. 用来暂时的保存数据,如果overflow了,缓冲区溢出,导致多余的数据已出道了邻近的内存位置,导致覆盖了重要的代码,从而有安全行为或者漏洞。

  1. Consequence: 正常情况会给程序干崩溃,通常用一个指向自己的恶意代码(shellcode)的指针覆盖返回地址,或者攻击者可以在函数返回的时候控制程序的执行流程。
  2. 如果登陆需要填写Authenticated才会进入,编译器在str之后立刻存储变量,攻击者可以通过提供21个字节的数据,覆盖掉返回地址,然后在后面加上shellcode,就可以控制程序的执行流程。

Program Memory Layout

  1. Stack: 用来存储局部变量,函数参数,返回地址,函数调用的上下文信息。
  2. Heap: 用来存储动态分配的内存,比如malloc, new。
  3. BSS (Block Start by Symbol) segment : 存储未初始化的全局/静态变量。
  4. Data segment: 用来存储全局变量,静态变量,常量。
  5. Text segment : 用来存可执行文件的可执行代码。

buffer 可以是stack或者heap。

Heap-Based attacks

如果成功,会导致任意代码饿执行访问崩溃,更具有挑战,需要更加了解目标陈旭的内存布局和管理。

Stack-Based attacks

LIFO(先进后出)的结构组织的,新添加的项目第一个被删除。

Stack(based on x86)

  1. Instruction Pointer(register %eip): 处理器执行的下体条命令。
  2. Stack Pointer(%esp): 指向栈顶的指针。
  3. (Current) Frame Pointer(%ebp): The Frame Pointer 是当一个函数被调用,新的Stack frame 被创建。

VPN(Virtual Private Network)

  1. Tunneling(隧道): VPN在你的设备和VPN服务器之间创建一个隧道,将你的数据密封在其中。包括encapsulation, transmission and decapsulation。
  2. Private Intranet: 一个私有网络,只有内部的设备可以访问,外部的设备无法访问。
  3. IP-in-IP Tunnel: 允许两个网络(Private Intranet)/设备之间建立安全的隧道链接,通过在原始IP数据包的头部添加一个新的IP头部来实现。可以让两个IP在公共网络中也可以安全的通信。工作原理如下图所示。

VPN routers(gateways 路由器)

  1. Standalone VPNs: 转饿为提供VPN功能而设计的专用网络设备。
  2. Integrated VPNs: 把VPN功能添加到现有设备,不需要专业设备。比如添加到路由器或者防火墙上。

Introduction

Cybersecurity Domains

  1. Critical Infrastructure Security 关键基础设施安全: 保护国家的基础设施,比如电力,交通,通信,金融。
  2. Network/Internet Security 网络/互联网安全: 授权访问,防火墙,入侵检测系统(IDS),入侵防御系统(IPS)和安全的网络架构。
  3. Application Security 软件安全: 保护应用程序,比如web应用程序,数据库,操作系统。
  4. Cloud Security yunanquan: 保护云计算环境。
  5. Information Security 信息安全: 保护信息,比如数据,文件,邮件,通信。
  6. End-User Education 用户教育: 保护用户,比如安全意识,安全培训,安全政策。
  7. Disaster Recovery/Business Continuity 恢复/业务连续性: 保护组织的业务,比如备份,恢复,灾难恢复计划,业务连续性计划。

E1.1

Respectively assuming yourself as

  • the owner/director of an SME (Small and medium-sized
    enterprise),
  • the IT manager in an organization, managing the IT facilities in
    the organization, and
  • the manager of the development team in an IT company, in
    charge of developing an app for on-line shopping,
    carry out some research and identify
  1. cybersecurity challenges and
  2. measures to tackle the challenges.

E1.1 solution

Owner/director of an SME:

Cybersecurity challenges:

Limited budget and resources for cybersecurity measures.
Lack of cybersecurity awareness among employees.
Vulnerability to ransomware, phishing, and other types of cyberattacks.

Measures to tackle the challenges:

Invest in essential security measures such as firewalls, antivirus software, and data backups.
Provide cybersecurity awareness training for employees.
Implement strong access control and password policies.

IT manager in an organization:

Cybersecurity challenges:

Securing a growing number of devices and endpoints.
Managing software and hardware updates to address vulnerabilities.
Ensuring compliance with data protection regulations.

Measures to tackle the challenges:

Implement a comprehensive endpoint security strategy, including regular patch management and vulnerability assessments.
Establish a clear incident response plan to handle potential cybersecurity incidents.
Collaborate with other departments to ensure data protection policies are adhered to.

Manager of the development team in an IT company (developing an online shopping app):

Cybersecurity challenges:

Protecting user personal information and payment data.
Preventing fraudulent activities, such as malicious refunds.
Mitigating the risk of Distributed Denial of Service (DDoS) attacks and other types of cyberattacks that can disrupt service availability.

Measures to tackle the challenges:

Implement strong encryption and secure coding practices to protect sensitive data.
Use secure and reliable payment processing services, and implement fraud detection mechanisms.
Deploy DDoS protection services and use cloud-based solutions with built-in redundancy to mitigate service disruptions.

Security Basic

Cybersecurity Threats

  • Malware (virus, trojan, worm, …)
  • Ransomware
  • Adware
  • Hacking
  • Spoofing
  • Phishing
  • Pharming
  • DDoS (Distributed Denial of Service) attacks (Botnets attacks)
  • Identity theft
  • SQL injection
  • Social engineering
  • Cryptojacking (Cryptocurrency Hijacking)
  • etc, the list goes on …

CIA(Confidentiality,Integrity and Availability)

  1. Discolosure(threats to confidentiality): confidentiality是防止对敏感信息的未授权访问,Discolosure是值对敏感信息的未授权访问。

    1. Snooping,sniffing(data in transit):在数据上传的时候拦截和读取数据的手段,加密可以有效防止。
    2. Unauthorized access(systems, data at rest):未经授权的访问系统和数据。
  2. Deception(fraud and forgeries; threats to integrity): 保证数据没有被篡改。

    1. Spoofing(identify theft): 攻击者模仿他人的证书通信模式假装成其他人。
    2. Unauthorized data modification: 未经允许的数据修改。
    3. Replay(intercept and retransmit): 涉及拦截和重传有效的数据传输
    4. Repudiation(false denial) of origin, repudiation of recipt: 当参与交易的一方否认他们是交易的一部分。
  3. Disruption: 使得系统无法正常工作。

    1. Modification: 对系统活数据的未经允许的改变。
    2. Delay: 影响服务的延迟。
    3. Denial of service: 使得系统无法正常工作。

Security Properties

  1. Freshness : 保证数据不是就数据的重放
  2. Non-repudiation: 防止虚假拒绝
  3. Fairness: 要么双方都收到认同的东西,活着都收不到东西

Achieving Security: life-cycle

没有绝对的安全。
Life-cycle分为三个步骤:

  1. threats analysis: 识别威胁
  2. design and implementation: 设计和实现
  3. security assurance: 确保安全

Attack Tree (Threat Tree)

root 是攻击目标,child是攻击方法。每一个节点都有一个likelihood 可能性,象征着入侵成功的概率。即货币成本,或者完成攻击所需要的成本。

Security models

A distributed system security model

  • 认证: 验证网络中用户和系统的身份,确保他们被授权访问资源。
  • 授权: 根据用户或系统的权限,授予或拒绝对特定资源的访问。
  • 完整性: 确保数据和系统组件不被未授权方篡改或改变。
  • 保密性: 保护敏感数据免受未经授权的访问和披露。
  • 可用性: 确保系统及其资源在需要时能被授权用户访问。

A communication security model

  • 加密: 对数据进行编码,以便只有拥有适当解密密钥的授权方才能访问该信息。
  • 认证: 验证通信各方的身份,以确保他们被授权参与通信。
  • 不可否认性: 提供一种手段来证明特定的一方参与了一项通信或交易,防止他们事后否认他们的参与。
  • 完整性: 确保传输的数据在传输过程中没有被改变或篡改。
  • 密钥管理: 安全地生成、分发和管理通信过程中使用的加密密钥。

An e-commerce security model

  • 安全通信: 利用加密协议,如SSL/TLS,来保护客户和服务器之间传输的敏感数据。
  • 认证: 验证用户、商家和系统的身份,以确保对资源和交易的安全和授权访问。
  • 授权: 根据用户角色和权限控制对资源和功能的访问。
  • 数据隐私: 通过加密和安全存储,确保保护敏感的用户信息,如信用卡号码和个人详细资料。
  • 欺诈检测和预防: 实施检测和减少欺诈性交易的系统,如监测可疑活动和实施强大的认证机制。

E2.1

Comment on the implications to risks (i.e. whether risks are increased or decreased) in
terms of Confidentiality, Integrity and Availability in each of the following cases:

  1. Disconnect a computer from the Internet
    Disconnecting a computer from the Internet reduces risks to confidentiality, but availability
    suffers. Integrity may also suffer due to loss of updates.

  2. Have extensive data checks by different people/systems
    Have extensive data checks by different people/systems can reduce risks to integrity, but
    confidentiality suffers as more people will be able to see the data. Availability will also suffer
    due to locks on data under verification

E2.2

  1. In this exercise, you are asked to identify, via literature research,
    potential cyber attack threats to mobile banking (i.e. perform
    banking transactions using your mobile phone). You are expected to
    be able to explain the attacking mechanism of each of your
    identified threats (i.e. how the attack is performed) and try to name
    any countermeasures to your identified threats.
  2. Draw a threat tree for ‘reading your best friend’s email without
    authorisation’.

Symmetric

$C = E_K(M) (or C = E(K, M)) \
M = D_K(C) (or M = D(K, C))
$

  • encryption function E_K(.), or a decryption function,
    D_K(.).
  • M is a plaintext block and C is a ciphertext block
    is a secret (a symmetric or a private key)

Block cipher design criteria(区块密码设计标准)

  1. Completeness(完整性): cipher text(密码文本)应该完全取决于 plain text(纯文本)。

  2. Avalanche effect (Diffusion雪崩效应,扩散): 输入text或者private key的任何一个微小的变化应该导致输出text的巨大变化。目的是防止暴力破解。

    1. 改变信息的一个bit 对应的输出信息很多个bit 得到改变。
    2. 改变private key的一个bit 对应的输出信息很多个bit 得到改变。
  3. Statistical independence (Confusion 混淆): 输入和输出的关系非常复杂,非线性函数或混合函数来实现的。目的是防止统计分析。

Feistel Block Cipher(费斯特尔区块密码)

  • XOR : 比较两个二进制位数之间的不同,相同返回0,不同返回1.
  • Round function(f): n位块进行输出n位块,
  • Block Size(n):
  • Key Size(s):
  • Number of rounds(r):一般大于10, 循环次数

费斯特尔密码依靠XOR操作和圆形函数的组合来创造一个更复杂和安全的加密过程。轮次函数引入了混乱和扩散,而XOR操作有助于有效地混合输入数据和轮次函数的输出。

加密和解密过程都知道参数,如回合数、密钥和具体的回合函数。当正确的密钥与这些参数一起使用时,解密过程将逆转加密过程中应用的操作,允许恢复原始明文。

DES (Data Encryption Standard)

DES is a Feistel block cipher

  1. 密钥 K 是 56 位;实际上是 8 个字节,但每个字节中的第 8 位是奇偶校验位
  2. 子密钥k1, k2 …, k16各为48位,由密钥K生成,解密和加密相同,唯一的不同是解密subkey的顺序反过来。
  3. DES不安全了,$2^{55}$次就可以破解,因为只是56-bit key, 但是DES的设计是很好的,所以可以用DES的设计思想,设计出更好的算法,比如3DES, AES。

Triple DES(3DES)

EDS2 (3DES 用两个keys)

$Ciphertext (C) = E_{K1}(D_{K2}(E_{K1}(Plaintext (M))))$

EDE2的密钥长度为112位(56位来自K1,56位来自K2)。在中间使用解密算法D对安全性没有直接影响。它的作用是在K1=K2的情况下使Triple DES向后兼容单DES,这意味着在这种情况下它可以像单DES一样发挥作用。

EDS2 (3DES 用三个keys)

$Ciphertext (C) = E_{K3}(D_{K2}(E_{K1}(Plaintext (M))))$

EDE3密钥长度168bits.

AES (Advanced Encryption Standard)

A symmetric block cipher same as DES.

  • 使用相同的密钥来加密和解密信息。
  • 明文和密码文本具有相同的大小。
  1. 不同于DES他是iterative而并非feistel cipher。
  2. 限定block size = 128 bit。加密和解密都用128bit。
  3. round(n):
    1. 对于一个128位的密钥长度,r = 10轮。
    2. 对于192位的密钥长度,r=12轮。
    3. 对于256位的密钥长度,r=14轮。

十六进制(hexadecimal (hex) number)

0x5B

  1. 0x 表示十六进制
  2. 5: $16^1 * 5$ (80)
  3. B: $16^0 * 11$ (11)
  4. 5B = 16 + 11 = 91

SubBytes

这个步骤只是为了让plaintext变得更加复杂。high and low nibbles of a byte是用来寻找S-box中特定的index的。
比如5B,high nibble是5,low nibble是B,inde就是S-box[5][11]。找到这个index,把这个index的值拿过来放到当前的5B在的位置。

Shift Row

Mix columns

$GF(P^n)$ (in AES, p=2, n=8)

In AES, $m(x)=x^8+x^4 +x^3+x^1+x^0$, i.e. 100011011 (or 11B) 这里因为使用了bitwise XOR,二进制等于1则有,0则没有。

Add round key

状态的128位与圆密钥的128位进行位数XOR: 由于状态矩阵和圆密钥矩阵都由16个字节(128位)组成,AddRoundKey转换的结果是另一个128位的矩阵,其中每个位是状态矩阵和圆密钥矩阵中相应位的XOR。

DES vs AES

N-bit block cipher 需要超过 2^N 来破解。

Stream Cipher

流密码是一种对称密钥加密算法,一次对明文数据进行加密,每次加密一个比特或字节。它们通过生成一个密钥流进行操作,密钥流是由秘密密钥产生的一个比特或字节序列。然后,密钥流与明文使用位XOR操作相结合,产生密码文本。

优点

Bitwise XOR 效率高

缺点

  1. Key length 密钥必须和明文一样长,这在大多数应用场景中是不现实的
  2. 如果同一个密钥被用于多个明文,流密码就会受到攻击。能够获得两个明文的XOR(M1 XOR M2)的攻击者,如果能够获得另一个plaintext及其相应的密码文本(M1和C1),就可以恢复其中一个明文。这是因为将M1与C1进行XOR(即M1 XOR K)会得到密钥K,然后攻击者可以使用K来解密C2(即M2 XOR K)并恢复M2。

    Bitwise XOR

$0 XOR 0 = 0 \
0 XOR 1 = 1 \
1 XOR 0 = 1 \
1 XOR 1 = 0$

PRNG

Replace the random key in One-time Pad by a pseudo-random
sequence, generated by a cryptographic pseudo-random generator that is ‘seeded’ with the key.

Modes of Encryption

如果消息比block size长。
o ECB – Electronic Code Book mode
o CBC – Cipher Block Chaining mode
o CTR – Counter mode

ECB

plaintext被分成很多与block size相同的text独立加密,然后再用分别的密钥独立解密。

  • 操作简便,但是对于有重复性的信息不安全。
  • 最后一个block不足block size,需要padding,最后一个字节表示padding的长度,方便接收后删除。
  • 加密: $C_n = E_k(M_n) (or E(K, M_n))$ 解密: $M_n = D_k(C_n); n = {1, 2, …}.$

CBC

与ECB一样,不过每一个cipher block 都是用前一个cipher block的ciphertext和当前的plaintext进行加密,所以前面的block坏掉,后面的全会影响。
$C_i = E_K(M_i XOR C_{i-1}), where C_0 = IV (Initialization Vector)$
Initialization Vector :是一个随机值,给第一个plaintext增加随机性用的。

CTR

目的是把block cipher变成stream cipher。
有一个计数器,计数器最大值等于block size的数量。每一个计数器的数量等于block size的数量,然后用计数器的值和密钥进行加密,然后和plaintext进行XOR。

  1. 可以并行化。
  2. 可以随机访问。
  3. 与plaintext的XOR可以预先计算。
  4. 一个block的丢失,同步就会丢失,无法复原plaintext。
  5. 一个在传输过程中被修改的密码文本块只影响该块的解密。

Block vs Stream Cipher

  • Block Cipher
  1. While block ciphers encrypt blocks of characters, stream ciphers encrypt individual characters or bit streams.
  • Stream ciphers
  1. are usually faster than block ciphers in hardware; mostly used for continuous communications and/or real-time applications.2. requires less memory space, so cheaper for resource
    restrained devices such as embedded sensors.
  2. have limited or no error propagation, so advantageous when transmission errors are probable.
  3. can be built out of block ciphers, e.g. by using CTR modes.

漏洞

  1. 不可以使用内置random 函数比如rand()。
  2. IVs should be random.

E3.1

By applying DES twice using two different 56-bit keys, K1 and
K2, to encrypt a message, M, i.e. $C=EK2[EK1[M]]$, where C is the ciphertext, we have a double DES encryption. Would this double DES encryption double the security level of a single DES
encryption? Justify your answer.

Public-key Cryptography (PKC)

One-Way Function

计算上不可逆转的函数。常用的单项函数:

  1. Integer factorization(整数因子化): 用于RSA加密方案,将两个大的质数相乘很容易,但再给他分解质因数是很难的。RSA中信息通过提高到两个大素数的乘积来加密,只有知道素数的人才能将它解密。
  2. discrete logarithm(离散对数): 用于DSS/DSA和Diffie-Hellman密钥交换。目的是寻找一个 ax=b mod p 的整数x的问题。其中a,b,p是已知的,x是未知的。这个问题是很难解决的,因为它需要尝试所有可能的x值,直到找到一个满足方程的值。这个问题的难度在于,当p很大时,x的可能值的数量是非常大的。

Algorithm

  • 适用于encryption(for symmetric key distribution): RSA, ElGamal, ECC
  • 只能数字签名: DSA
  • 只能key agreement : DH
  • 加密和数字签名: RSA ElGamal Rabin
  • Examples:
    9 mod 5 = 4
    20 mod 9 = 2
    17 = 2 mod 5 since 17-2 = 3 ·5

    RSA

    两个大素数(100-400)的乘积。

Hybrid Cryptosystems

Digital Signature

  1. Message-dependent: 数字签名需要依赖消息的内容,包括时间日期等细节。
  2. Unreusable: 数字签名不可重复使用,每条信息的数字签名都是唯一的。
  3. Ensures content integrity: 数字签名保证信息在签名过后的完整性。
  4. Signer-dependent: 数字签名独属于签名着,不可以轻易被其他人创建。
  5. Unforgeable: 很难被伪造。
  6. Ensures origin authentication: 确认信息来源。
  7. Verifiable: 可以被验证。
  8. Anti-forgery: 数字签名不可伪造,因为它是基于签名者的私钥进行加密。

DSS/DSA(纯数字签名的方法)

Cryptographic Checksum(加密校验)

需要加密校验的地方

  1. Public-key encryption, A –> B: $E_{KUb}$ [M] 用B的public key加密。B不知道是谁发的,也不能确定消息完整性。所以需要校验。
  2. Digital signing, A –> B: M||$E{KRa}$ [h(M)] 用A的private key加密。不可抵赖性,因为明确是A发出的,并且消息完整。但是无法保证保密性。

加密校验分为两种,hash function 和 Macs。

对比于数字签名

加密校验和和数字签名都是相关的,因为它们都是用来确保数据的完整性和真实性。然而,加密校验使用哈希函数或MAC,而数字签名则依靠公钥密码学。此外,数字签名提供不可抵赖性,这意味着发送者不能否认发送过数据,而加密校验则不提供这一功能。

Hash Function

Compression Property(压缩特性)

h = H(M) , h是 message digest(信息摘要)。由于是多对一映射,有可能collisions,尽可能避免。

生成hash 摘要用很多个block,不断用不同的hash function对上一次的hash message进行hash。最后的hash 是整个message的hash摘要。

Security Requirements/Properties(安全特性)

  1. Preimage resistant(one-way单向性): 无法反向。
  2. 2nd preimage resistant(week coliision resistance弱碰撞性): 无法找到另一个message,使得hash值相同。
  3. Collision resistance (strong collision resistance强抗碰撞): 很难找到相同哈希值的和两个输入。

例子

A 发送信息M给B, $M||s$ , $s = E_{KRa}[H[M]]$. 攻击者发现了另外一个meesage,这个message和M有着相同的hash,我们就可以把这个替换成原本的message。这就是collision attack。

MAC(Message Authentication Code)

HMAC

AEAD(Authenticated Encryption with Associated Data)

在AEAD(带关联数据的认证加密)中,其目的是为明文信息(有效载荷)提供保密性,并确保明文信息和关联数据(头)的完整性和真实性。AEAD的加密过程需要以下输入:

头(关联数据): 信息的一部分,通常不需要保密性,但需要完整性和真实性保护。
明文(Plaintext): 正在传输的实际内容或数据,需要保密。
密钥: 用于加密和认证过程的秘密密钥。
Nonce: 一个独特的值,将随机性引入加密过程。
当你使用这些输入进行AEAD加密时,你将得到以下输出:

密码文本: 明文信息的加密版本,确保其保密性。
认证标签: 一个验证加密的有效载荷(密码文本)和相关数据(头)的完整性和真实性的值。
然后,发送方将头、Nonce、密码文本和认证标签传送给接收方。收件人使用相同的密钥、nonce和头来解密密码文本并验证认证标签。如果验证成功,收件人可以确定该信息没有被篡改,并且它来自拥有相同密匙的合法发件人。

因此,收件人收到以下组件:头、nonce、密码文本和验证标签。然后,收件人使用这些组件以及共享的秘密密钥来解密密码文本,并验证整个信息的完整性和真实性。

CCM 和 GCM

CGM 和 GCM 都是AEAD,并且都基于AES。GCM更加灵活,性能更好。

length attack

攻击者知道正在使用的哈希函数和哈希输出的长度。他们也知道原始信息M的长度,但不知道秘钥K或其长度。

E5.1

  1. M||Tag, where Tag=H(M||K)
  2. M||Tag, where Tag=E(K, H(M))
  3. M||Tag, where Tag=E(PRs, H(M))
  4. E(K, M||H(M))

Security Key

Key Management Issues

  1. Key generation : 多个输入生成key,比如硬件信息,到达时间等等。
  2. Key storage : 保存key,比如不联网的硬盘。或者把钥匙分成两部分k1,k2):k2= k1 xor K。

Diffie-Hellman Algorithm/Protocol

第一个public key 生成算法, 容易收到MITM(man in the middle)的攻击。就两方都一位攻击人的public key和private key是对方的。可以用digital signatures 或者 PKI 来验证公钥。

Needham-Schroeder(分发会话密钥的方法)

without using PKC

  • KDC(Key Distribution Center): 可信任第三方,密钥分发中心。协议目的是建立一个共享的one-time session key($K_{ab}$)
  • Nonces($N_a ,N_b$),Alice 和 Bob 给的随机,用来保证信息的freshness。不会被replay attack。

Ka被KDC用来为Alice加密信息,Alice用Ka来解密从KDC收到的信息。
Kb被KDC用来为Bob加密信息,而Bob用Kb来解密从KDC收到的信息。
Kab是Alice和Bob用来加密和解密他们之间信息的会话密钥。
因此,虽然Ka和Kb用于每一方与KDC之间的加密和解密,但Kab用于Alice和Bob之间的加密和解密。

PKC 2 pass

PKC 3 pass

E6.1

Assuming that Alice is to send a message, M, to Bob. M is encrypted with a shared key established using the DH protocol.
Explain whether Eve could access this message M. If so, explain how, and propose a solution to address this vulnerability.Assuming that Alice is to send a message, M, to Bob. M is encrypted with a shared key established using the DH protocol. Explain whether Eve could access this message M. If so, explain how, and propose a solution to address this vulnerability.

how :
This is an active attack. The attacker in tercepts and substitutes Ya and Yb with Ye.
So at the end of the message exchanges, Eve will have Kae, Kbe, Alice will have Kae and Bob will have Kbe. Any messages encrypted with Kae will be decrypted and read by Eve and then re-encrypted with Kbe and vice versa without the knowledge of Alice and Bob.

solution 1 Fix DH:

Server’s and client’s public key certificates contain their respective DH public key parameters. In other words, the DH public keys are certified by a CA. But there has to be a way that Alice and Bob could prove to each other that they are the rightful owners of the corresponding certificates (unless the identity of one entity is already known to the other). With this method, the established symmetric key is not really a session-valid key. So the security level is not as high as the second method.

solution 2 Ephemeral DH:

DH public keys are exchanged, signed using the sender’s private DSA key; the receiver uses the corresponding public keys (certified in the certificates) to verify the signatures. The certificates are used to certify the DSA keys, and DH shares are signed using DSA by the respective signers. This is the so called DH-DSA method, used to create a temporary, one-time session key.

E6.2

• This simply protocol does not provide mutual authentication: it does not show that the public key has been certified and that the demonstration of private key associated to the public key in the certificate is missing. Eve can intercept the message, creates its own public/private key pair {PUe, PRe} and transmits PUe||IDA to Bob. Bob generates a secret key, Ks, and transmits E(PUe, Ks). Eve intercepts the message and learns Ks by computing D(PRe, E(PUe, Ks)). Eve transmits E(PUa, Ks) to Alice. The result is that both Alice and Bob know Ks and are unaware that Ks has also been revealed to Eve. Alice and Bob can now exchange messages using Ks. Eve no longer actively interferes with the communications channel but simply eavesdrops. Knowing Ks, Eve can decrypt all messages, and both A and B are unaware of the problem.

E6.3

This is the Needham-Schroeder protocol. Answer the following questions:

  1. What are the benefits for A to forward the session key to B (i.e. step 3), rather
    than letting KDC to directly send the session key to B?
  2. TRY to identify two application areas of the Needham-Schroeder protocol and to
    elaborate the benefits of using the Needham-Schroeder protocol in these
    application areas

Q1
Benefits:

  1. reduced involvement of KDC, thus less overhead not just for KDC also for B;
  2. This protocol (designed in this way) can also be used for authentication
    purpose, in addition to confidential communication between A and B.

Q2 Two applications: one is establishing a secure communication channel; and the
other is for authentication service.

• Benefits:
• Party A (i.e. user) does not need to remember many keys while being able to
use a different key for a different correspondent;
• When used for authentication, the protocol supports single sign-on, i.e. a
user only need to remember a single password, but is able to use different
short-term secrets for different servers and the users’ master secrets (i.e.
long-term passwords) are only managed by one entity, i.e. KDC.

PKI(Public Key Infrastructure)

Overview

VPN , 网页浏览器 , PGP 等都会用到 , 银行卡 , 数字版权。

  1. How to ensure the security (secrecy and strength)
    of the private key ?
  • The key size should be large enough.
  • The lifetime of the key should guard against brute-force
    attacks.
  • The key should be kept secret; they should be
    generated, transported, stored and destroyed (at the end
    of its lifetime) securely.
  1. How to ensure that a public key is trustworthy ? how
    could we trust that a given public key indeed belongs to a claimed entity.
  • The solution is to have some trusted entity or authority to sign one’s public key -> digital certificate.
  • Otherwise, communications are vulnerable to man-in-themiddle attack.

Signature of CA

它将公共密钥与一个人、硬件设备或软件过程的身份结合起来。 证书由一个CA进行数字签名。这个签名可以用CA的公开密钥进行验证。这样,任何收到证书的人都可以验证它确实是由CA签发的,并且没有被篡改过。证书中包含的信息可以根据其目的而有所不同。例如,用于安全电子邮件通信的证书可能包含持有人的电子邮件地址。用于金融交易的证书可能包含信用卡号码和信用额度

CRL(Certificate Revocation List)

吊销证书

  1. date and time of the CRL publications.
  2. name of the issuing CA.
  3. serial numbers of all the revoked certificates.

所以使用证书的时候需要确认

  1. It has a valid CA signature
  2. It has not expired, and
  3. It is not listed in the CA’s most recent CRL.

top-down certificate hierarchy,

如果Bob想认证Alice,他需要找到他信任的证书给Alice签发的。

CERT 表示的是自己的证书。
S_{DeptQ} 表示的是由DeptQ信任

self-signed (a standalone or root CA) 自签头证书

bottom-up

没有受信任的锚: 没有一个中央受信机构或锚,如根证书颁发机构(CA),来颁发和管理所有证书。

终端实体充当CA: 通常,终端实体(用户、设备、应用程序)为他们认识和信任的其他实体签署证书,本质上是充当他们自己的证书机构。

信任评估机制: 因为没有中央机构可以隐含信任,所以需要一个机制来评估每个证书或CA的信任程度。这种模式下的信任是主观的,是基于个人决定的。

PGP解决方案: 这种模式在PGP(Pretty Good Privacy)中使用,它是一种加密程序,为数据通信提供加密隐私和认证。在PGP中,用户独立决定他们信任谁。

与自上而下的层次结构相比, 自下而上的模式提供了更多的用户自主权, 但由于缺乏一个单一的可信任的权威机构, 在管理和扩展上可能会更加复杂。

MasterCard

SecureCode解决方案是基于3-D域安全(3DS)模型,它代表了参与此类交易的三个主要参与者

Acquirer Domain (Merchant)商家

Issuer Domain (Cardholder)

注册是这个过程中的一个关键步骤。在注册过程中,持卡人(CH)提供相关的身份和个人信息。这可能包括密码、个人保证信息(PAM)或其他形式的识别。这些信息被收集、验证,然后传递给发卡人的访问控制服务器(ACS)

Access Control Server (ACS):

  1. Verification 验证一个账号是否注册
  2. AuthenticationACS负责对持卡人进行认证
  3. Signing Authentication Outcomes 购买的人是否合法人

E7.1

(ii) X.509 is a top-down approach to public key management. Investigate and
describe a bottom-up approach to public key management.

Assumption: You knows A, B, C, D, E, F.
Let us say H wants to communicate with
You, You do not know H, but You know A
and B, and A and B know H. So A and B can
sign H’s public key.
If A and B are fully trusted by You, then one
signature (on H’s public key), either from A
or B, would be sufficient.
However, if A and B are partially trusted by
You, then signatures from both A and B may
be necessary.
You can use other heuristics, e.g. if You gives
¼ trust to each of the entities he knows,
then 4 signatures on the public key of an
entity You does not know would be
required.

E7.2

Assuming that Alice has sent a signed message to Bob.
(i) Highlight the steps for verifying a digital certificate.
(ii) Highlight the steps Bob takes to verify the authenticity of the message from
Alice.

(i)

  • Check validity period to see if it is expired.
  • Check CRL list to see if the certificate has been revoked.
    • Verify the signature on the cert:
    • Calculate a message digest for the certificate
    • Use the CA’s public key to decrypt the digital signature and recover what is
      claimed to be the original message digest embedded within the certificate
  • Compare the two resulting message digest values to ensure the integrity of
    the certificate

(ii)

  • Verify the certificate or chain of certificates
  • Verify Alice’s signature

User Identification and Authentication

Overview

Password-based Authentication

Plaintext PW method

服务器和客户端之间的所有通信都应通过安全通道,如HTTPS或SSL/TLS,以防止在传输过程中窃听或截获明文密码
受到这些威胁, Interception during Transmission(传输过程中的拦截),Server Breach(服务器被攻破), Insider Threat(内部威胁), Replay Attacks(重放攻击)。

Hashed PW method

安全的哈希函数: 使用一个加密安全的哈希函数,它能抵抗碰撞攻击。这意味着几乎不可能找到两个不同的输入,产生相同的哈希输出。

Hashed PW with Salt method

带盐可以防止彩虹表攻击(rainbow attack)

密码创建: 当用户创建他们的密码时,会产生一个独特的盐。盐和密码被串联起来,然后一起散列。盐和散列值(h1)都存储在服务器上的一个安全位置(例如,在基于Unix的系统上的/etc/shadow文件中)。

认证: 当用户输入他们的密码来登录时,这个过程会重复进行。存储的盐被附加到输入的密码上,然后对组合进行散列。这将产生一个新的哈希值(h2)。

Unix authN Solution: Crypt()

DES + salt , 提高了彩虹表4096倍, 但现在不行了,bcrypt或者scrypt。

Conclusions

密码是最基本的认证机制
Ø安全级别只和你选择的密码一样好。
Ø它们很容易被猜中,除非采取预防措施确保
有足够大的可能的密码集,并且其中的每一个
潜在的密码被选中的可能性是相同的。
Ø挑战-回应技术允许系统改变密码,因此不容易受到猜测攻击。
因此,密码不容易被猜测攻击;OTP是这种技术的一个例子、
OTP是这种技术的一个例子,它对猜测和重放攻击特别有效。
q 认证也可以通过公钥加密技术实现。
也可以用公钥加密法实现,这需要公钥证书–X.509
标准。

还有其他形式的认证:生物识别技术测量用户的身体特征
用户的身体特征;位置要求验证者
来确定用户的位置。

PKC 应用: Confidentiality, Signatures and integrity , Identification and authentication , timestamping.

考点

Topic 3 : Applications , when you should use which function? Which function you use in which application , in which times, do not focus on details. But why they are efficient , why they are not efficient. How to use them?

Topic 4 : DSA 不用记数学公式。

Topic 5 : 那几个公式要背。GCM不需要背。

Topic 6,7,8,9,10,11 : 全需要背。

Con

IPsecs

  • Transport Mode vs Tunnel Mode: transport只加密payload(数据),tunnel model 同时加密head和payload。 AH 无论用哪个model都不可以加密。上诉情况是指ESP。
  • AH(Authentication Header):
    • data origin authentication 数据来源认证
    • data integrity 完整性
    • anti-replay 防重放 (SequenceNumber),IPsec header中有一个每个data package 的唯一序列号。从SA第一个数据报开始。
    • does not provide confidentiality protection 不提供保密性保护
    • outboard(sender)
      • SA lookup : SA 由key , security protocal(AH, ESP), security parameters index(SPI)组成。
      • 生成序列号
      • 计算MAC
    • inboard(receiver)
      • Resumably(重组):较大数据需要被分割fragmented, 所以收到后要reassemble重组。
      • SA lookup : receiver 确定是正确的SA.
      • Sequence Number Verification
      • MAC 验证: 确保信息没有被修改。
  • ESP(Encapsulating Security Payload):
    • outboard SA lookup 后面加密。 encrypt-then-mac 比mac-then-encrypt 或者mac-and-encrypt 更安全。在密码文本上计算mac,防止padding oracle attack(填充神谕攻击)
    • inboard MAC 之后解密。
    • 比AH authentication认证更窄,因为AH保护所有数据,ESP不保护head。不需要confidentiality保密的时候AH是一个合适的协议。

CA 和 KDC

CA 是 asymmetric 的 , KDC 是 symmetric的。

HMAC

HMAC(K, M)= H[(K+ XOR opad) || H[(K+ XOR ipad) || M]];

Attack

  • Replay attack: eve拦截了data package 并且transmit很多次,让recipient以为自己收到了很多次。

  • padding oracle attack填充神谕攻击: eve利用解密过程中的错误信息来得到plaintext的内容。通常是mac直接通过plaintext得到而造成的。

  • meet-in-the-middle attack: 发生在双重加密之中。对前半段解密,后半段猜测为加密的信息进行加密。两者重合,寻找密钥。证明了双重加密无法提供两倍的安全性,所以三重。

  • cookie hijacking: 会话劫持,如果信息都暴露通常也伴随着被会话劫持。

  • brute force attack:

  • dictionary Attack: eve尝试生日,常见组合来破解密码。

  • rainbow table attack : 预先计算好的表,反转加密的hash function, 就是破解hash值的dictonary attack.

    security properties

  • integrity : 完整性 Hash.

  • confidentiality : 保密性

  • authenticity : 验证来源,CA.

  • non-repudiation: 不可抵赖性, 通常通过digit signature.

  • authorization: 授权。不同的用户有不同的权限。

一些名词

PKI,CA,RSI,ECB,CBC,CTR,

AES(block cipher)

DES 8 bytes block , AES 16 bytes block.

formula

  1. EDE2(triple DES using 2 keys) : C = EK1(DK2(EK1(M)))
  2. EDE3(triple DES using three keys): C = EK3(DK2(EK1(M)))
  3. AES
  4. ECB : Cn = E(K, Mn) ; Mn = D(K, Cn); n = {1, 2, …}. (别忘了padding)
  5. CBC : Ci = E(K , Mi XORCi-1), where C0 = IV (Initialization Vector) ; Mi = D(K, Ci) XOR Ci-1 , M0 = IV (别忘了padding)
  6. CTR : Ci = E(K, Counter + i) XOR Mi; i = {1, 2, …}. Mi = E(K, Counter + i) XOR Ci ; i = {1, 2, …}.

如果消息比block size长。

ECB

 Cn = Ek(Mn) (or E(K, Mn));
 Mn = Dk(Cn); n = {1, 2, …}.
plaintext被分成很多与block size相同的text独立加密,然后再用分别的密钥独立解密。

  • 操作简便,但是对于有重复性的信息不安全。
  • 最后一个block不足block size,需要padding,最后一个字节表示padding的长度,方便接收后删除。

    CBC

    与ECB一样,不过每一个cipher block 都是用前一个cipher block的ciphertext和当前的plaintext进行加密,所以前面的block坏掉,后面的全会影响。
    Initialization Vector :是一个随机值,给第一个plaintext增加随机性用的。

    CTR

    目的是把block cipher变成stream cipher。
    有一个counter 和 nonce 计数器最大值等于block size的数量。每一个计数器的数量等于block size的数量,然后用计数器的值和密钥进行加密,然后和plaintext进行XOR。
  1. 可以并行化。
  2. 可以随机访问。
  3. 与plaintext的XOR可以预先计算。
  4. 一个block的丢失,同步就会丢失,无法复原plaintext。
  5. 一个在传输过程中被修改的密码文本块只影响该块的解密。

Stream Cipher

流密码是一种对称密钥加密算法,一次对明文数据进行加密,每次加密一个比特或字节。它们通过生成一个密钥流进行操作,密钥流是由秘密密钥产生的一个比特或字节序列。然后,密钥流与明文使用位XOR操作相结合,产生密码文本。å

优点

Bitwise XOR 效率高

缺点

  1. Key length 密钥必须和明文一样长,这在大多数应用场景中是不现实的
  2. 如果同一个密钥被用于多个明文,流密码就会受到攻击。能够获得两个明文的XOR(M1 XOR M2)的攻击者,如果能够获得另一个plaintext及其相应的密码文本(M1和C1),就可以恢复其中一个明文。这是因为将M1与C1进行XOR(即M1 XOR K)会得到密钥K,然后攻击者可以使用K来解密C2(即M2 XOR K)并恢复M2。

stream和block 的区别

  1. block 对字符块进行加密,stream对单个bit\character进行加密。

UNIX

croe: 14mo31bmRY0Yg: 12:31:Cathy Roe: /home/croe:/bin/csh

  • unix password file: /etc/passwd
  • User Name : croe
  • Password (14mo31bmRY0Yg) : salt value(14) + hash password
  • User ID(UID) : 12
  • Group ID(GID) : 31
  • Home Directory (/home/croe)
  • Shell (/bin/csh)

RSA step

two prime number p,q
f(n) = (p-1)(q-1)
1 < e < f(n)
d x e = 1 mod f(n)
KPU = {e,n}
KPR = {d,n}
encrypt: message M < n , C = M^e mod n
decrypt: M = C^d mod n

SA

  1. negotiate policy such as authentication method , enctyption and has halgorithms , AH/ESP,etc.

Exercise Question – E9.1

What is the major difference between transport mode and tunnel
mode in IPSec ESP, and any implications?

Unlike the tunnel mode, the transport mode only encrypts the
payload, not header. This means that in the transport mode, address info
and other header info are exposed.


Cyber_security
http://example.com/2023/04/24/Cyber-security/
Author
Chenxi Qu
Licensed under