moooofly

Results 187 comments of moooofly

# MAC(Message Authentication Code 消息验证码) 想要校验消息的完整性,必须引入另一个概念:消息验证码。消息验证码是一种与秘钥相关的单项散列函数。 ![image](https://user-images.githubusercontent.com/7439290/52833571-4cdc6880-3118-11e9-869c-2abc4a352533.png) 密文的收发双发需要提前共享一个秘钥。密文发送者将密文的 MAC 值随密文一起发送,密文接收者通过共享秘钥计算收到密文的 MAC 值,这样就可以对收到的密文做完整性校验。当篡改者篡改密文后,没有共享秘钥,就无法计算出篡改后的密文的 MAC 值。 如果生成密文的加密模式是 CTR ,或者是其他有初始 IV 的加密模式,别忘了将初始的计数器(值)或初始向量的值作为附加消息与密文一起计算 MAC 。

# GMAC(Galois message authentication code mode 伽罗瓦消息验证码) 对应到上图中的消息认证码,GMAC 就是利用伽罗华域(Galois Field,GF,有限域)乘法运算来计算消息的 MAC 值。假设秘钥长度为 128bits,当密文大于 128bits 时,需要将密文按 128bits 进行分组。应用流程如下图: ![image](https://user-images.githubusercontent.com/7439290/52833648-c3796600-3118-11e9-8846-e1957d7b48b1.png)

# GCM(Galois/Counter Mode) GCM 中的 G 就是指 GMAC,C 就是指 CTR 。 GCM 可以**提供对消息的加密和完整性校验**,另外,它还可以**提供附加消息的完整性校验**。在实际应用场景中,有些信息是我们不需要保密,但信息的接收者需要确认它的真实性的,例如源IP,源端口,目的IP,IV,等等。因此,我们可以将这一部分作为附加消息加入到 MAC 值的计算当中。下图的 Ek 表示用对称秘钥 k 对输入做 AES 运算。最后,密文接收者会收到密文、IV(计数器 CTR 的初始值)、MAC 值。 ![image](https://user-images.githubusercontent.com/7439290/52833734-3682dc80-3119-11e9-929f-2a79aa0173c1.png)

# Android cryptography > ref: https://developer.android.com/guide/topics/security/cryptography ![image](https://user-images.githubusercontent.com/7439290/52839034-b0be5b80-312f-11e9-9180-3ef35ab9a029.png)

## 排查 [fluent/fluent-plugin-kafka](https://github.com/fluent/fluent-plugin-kafka) 插件的 bug ### 背景 - 业务需要把用户操作的日志以 protobuf 格式发送到对应的 topic 中(russell__user_operation_history)为数据方提供服务,使用的是 github.com/Shopify/sarama 开源库。 - 业务方的设计是系统通过 russell__user_operation_history 这个 topic 将日志提供给数据分析的一方,而不是进入 elk 系统; - fluentd 负载采集 container 中业务输出到 stdout 上的日志,并见将其打入到...

补充: - 代理转发请求本来就不需要保证请求头原封不动的发给服务器啊,一方面对于 `Connection`、`Prxoy-Authenticate`、`Proxy-Connection`、`Transfer-Encoding` 和 `Upgrade` 这些逐跳的头部,代理在转发时本来就需要根据实际情况保留;另一方面**即使不是逐跳的头部,代理进行修改也很常见**。 - **每个节点都只能与相邻节点建立长连接**。代理删掉了 keep-alive,它与下一个节点就不能使用长连接。当然下一个节点又可以把 keep-alive 加回去,这样它和再下一个节点又可以使用 keep-alive 了。 - Fiddler 会删掉 `Proxy-Connection` 头部,然后请求头部的时候带上自己认为合适的 `Connection`(一般肯定是 `Connection: keep-alive`)。因为 `Proxy-Connection` 和 `Connection` 是逐跳的,只作用于两个最近的节点,每个节点都应该删掉之前的 `Proxy-Connection` / `Connection`,然后根据自己实际情况发送它们。

# [ELB is dropping connections?](https://forums.aws.amazon.com/thread.jspa?threadID=32280) We appreciate the feedback resulting from your performance tests. We want to provide some information about the Elastic Load Balancing service that should help guide...

# [Amazon EC2 Elastic Load Balancer: Does its IP ever Change?](https://stackoverflow.com/questions/3821333/amazon-ec2-elastic-load-balancer-does-its-ip-ever-change) **Q**: Does the ELB's IP Ever Change once setup, or will it always access instances from the same location...

# [Elastic Load Balancing Deep Dive and Best Practices](https://www.slideshare.net/AmazonWebServices/elastic-load-balancing-deep-dive-and-best-practices-popup-loft-tel-aviv?from_action=save) ![image](https://user-images.githubusercontent.com/7439290/51105033-d7ccf900-1822-11e9-8e70-264a38633553.png) ![image](https://user-images.githubusercontent.com/7439290/51105059-e9ae9c00-1822-11e9-82fc-2052eb741289.png) ![image](https://user-images.githubusercontent.com/7439290/51105120-1793e080-1823-11e9-9554-4bc47b0741ed.png) ![image](https://user-images.githubusercontent.com/7439290/51107633-46fa1b80-182a-11e9-8889-5cc40c5804d3.png) ![image](https://user-images.githubusercontent.com/7439290/51105208-59248b80-1823-11e9-853c-ead80bdcef58.png) ![image](https://user-images.githubusercontent.com/7439290/51105287-8a04c080-1823-11e9-91c2-7ce1382704a8.png) ![image](https://user-images.githubusercontent.com/7439290/51105341-b0c2f700-1823-11e9-97ea-d1ce76f36ac9.png) ![image](https://user-images.githubusercontent.com/7439290/51107700-7f99f500-182a-11e9-9a4c-a9445553ca61.png) ![image](https://user-images.githubusercontent.com/7439290/51107707-86c10300-182a-11e9-8fa0-643fe1ad2eda.png) ![image](https://user-images.githubusercontent.com/7439290/51108525-76f6ee00-182d-11e9-87ec-b408a46ad2bb.png) ![image](https://user-images.githubusercontent.com/7439290/51108680-ea98fb00-182d-11e9-838e-ba6655167816.png) ![image](https://user-images.githubusercontent.com/7439290/51110336-503bb600-1833-11e9-96e0-2d731dde199d.png) ![image](https://user-images.githubusercontent.com/7439290/51110369-73fefc00-1833-11e9-970d-907674d2b348.png) ![image](https://user-images.githubusercontent.com/7439290/51110408-87aa6280-1833-11e9-8187-8a78c6f43f56.png) ![image](https://user-images.githubusercontent.com/7439290/51110422-95f87e80-1833-11e9-9f07-fe10c3c20db6.png) ![image](https://user-images.githubusercontent.com/7439290/51110434-9d1f8c80-1833-11e9-91ec-3c88ae629d64.png) ![image](https://user-images.githubusercontent.com/7439290/51110442-a4df3100-1833-11e9-9994-ff97107cbf50.png)

# [AWS Elastic Load Balancing: Load Balancer Best Practices](https://www.sumologic.com/blog/devops/aws-elastic-load-balancer-best-practices/) - Read the Docs! - Plan your Load Balancer Installation - SSL Termination - Configure Cross-Zone Load Balancing - Global Load...