网安学习日记之 PKI技术

PKI(Public Key Infrastructure)公钥基础设施

作用

通过加密技术和数字签名保证信息的安全

组成

公钥加密技术,数字证书,CA,RA

信息安全三要素

机密性,完整性,身份验证/操作的不可否认性

PKI应用领域

1)SSL/HTTPS
2)IPsecVPN
3)部分远程访问VPN

公钥加密技术

作用:实现对信息加密,数字签名等安全保障
加密算法:
	1)对称加密算法
		*加解密的密钥一致!
		*DES 3DES AES
	2)非对称加密算法
		*通信双方各自产生一对公私钥
		*双方各自交换公钥
		*公钥和私钥为互相加解密关系!
		*公私钥不可互相逆推!
		*RSA DH

x+5=y (算法)
x : 原数据/ 原文
y : 密文
5 :key/密钥
HASH算法:MD5 SHA (验证完整性)
HASH值可逆吗?不可逆!
HASH值 = 摘要
数字签名:用自己的私钥对摘要加密得出的密文就是数字签名

对称加密和非对称加密
a向b发敏感文件需要加密对称加密就是,a用锁锁住文件,发给b,然后a再发钥匙给b,b拿到锁和钥匙,解锁文件
非对称加密是,a要像b发文件,b把自己的锁发给a,a锁好后给b,b的钥匙一直在自己手上,用自己的钥匙(私钥)解自己的锁(公钥),这样就不用担心钥匙在传递过程中被窃取。

证书

证书用于保证公钥的合法性
证书格式遵循X.509标准
数字证书包含信息:
	使用者的公钥值
	使用者标识信息(如名称和电子邮件地址)
	有效期(证书的有效时间)
	颁发者标识信息
	颁发者数字签名
数字证书由权威公正的第三方机构即CA颁发
CA 是权威证书颁发机构,为了公正“公钥”的合法性
机密性:使用对方的公钥加密
身份验证/数字签名:使用自己的私钥加密

附上三个图解

非对称加密过程

在这里插入图片描述

数字签名过程

在这里插入图片描述

数字证书

在这里插入图片描述

华为OD华为公司用于招聘软件开发工程师的一项重要考核环节。2024华为OD题库中包含了多种类型的编程题目,主要以C语言为主。以下是一些常见的题型和示例: 1. **基础算法题**: - 题目:实现一个函数,计算两个整数的最大公约数(GCD)。 - 示例代码: ```c #include <stdio.h> int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int a, b; printf("Enter two integers: "); scanf("%d %d", &a, &b); printf("GCD of %d and %d is %d\n", a, b, gcd(a, b)); return 0; } ``` 2. **数据结构题**: - 题目:实现一个简单的链表,并提供插入和删除操作。 - 示例代码: ```c #include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node* next; }; void insert(struct Node** head_ref, int new_data) { struct Node* new_node = (struct Node*)malloc(sizeof(struct Node)); new_node->data = new_data; new_node->next = (*head_ref); (*head_ref) = new_node; } void deleteNode(struct Node** head_ref, int key) { struct Node *temp = *head_ref, *prev; if (temp != NULL && temp->data == key) { *head_ref = temp->next; free(temp); return; } while (temp != NULL && temp->data != key) { prev = temp; temp = temp->next; } if (temp == NULL) return; prev->next = temp->next; free(temp); } void printList(struct Node* node) { while (node != NULL) { printf("%d ", node->data); node = node->next; } } int main() { struct Node* head = NULL; insert(&head, 3); insert(&head, 2); insert(&head, 1); printf("Created Linked List: "); printList(head); deleteNode(&head, 2); printf("\nLinked List after Deletion of 2: "); printList(head); return 0; } ``` 3. **逻辑题**: - 题目:给定一个整数数组,找出其中没有出现的最小正整数。 - 示例代码: ```c #include <stdio.h> int firstMissingPositive(int* nums, int numsSize) { for (int i = 0; i < numsSize; i++) { while (nums[i] > 0 && nums[i] <= numsSize && nums[nums[i] - 1] != nums[i]) { int temp = nums[nums[i] - 1]; nums[nums[i] - 1] = nums[i]; nums[i] = temp; } } for (int i = 0; i < numsSize; i++) { if (nums[i] != i + 1) { return i + 1; } } return numsSize + 1; } int main() { int nums[] = {3, 4, -1, 1}; int size = sizeof(nums)/sizeof(nums[0]); printf("The smallest missing positive integer is %d\n", firstMissingPositive(nums, size)); return 0; } ``` 这些题目涵盖了C语言编程中的基础算法、数据结构和逻辑思维等方面。准备华为OD时,建议多练习类似题型,提升编程能力和解题技巧。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值