moooofly
moooofly
# MAC(Message Authentication Code 消息验证码) 想要校验消息的完整性,必须引入另一个概念:消息验证码。消息验证码是一种与秘钥相关的单项散列函数。  密文的收发双发需要提前共享一个秘钥。密文发送者将密文的 MAC 值随密文一起发送,密文接收者通过共享秘钥计算收到密文的 MAC 值,这样就可以对收到的密文做完整性校验。当篡改者篡改密文后,没有共享秘钥,就无法计算出篡改后的密文的 MAC 值。 如果生成密文的加密模式是 CTR ,或者是其他有初始 IV 的加密模式,别忘了将初始的计数器(值)或初始向量的值作为附加消息与密文一起计算 MAC 。
# GMAC(Galois message authentication code mode 伽罗瓦消息验证码) 对应到上图中的消息认证码,GMAC 就是利用伽罗华域(Galois Field,GF,有限域)乘法运算来计算消息的 MAC 值。假设秘钥长度为 128bits,当密文大于 128bits 时,需要将密文按 128bits 进行分组。应用流程如下图: 
# GCM(Galois/Counter Mode) GCM 中的 G 就是指 GMAC,C 就是指 CTR 。 GCM 可以**提供对消息的加密和完整性校验**,另外,它还可以**提供附加消息的完整性校验**。在实际应用场景中,有些信息是我们不需要保密,但信息的接收者需要确认它的真实性的,例如源IP,源端口,目的IP,IV,等等。因此,我们可以将这一部分作为附加消息加入到 MAC 值的计算当中。下图的 Ek 表示用对称秘钥 k 对输入做 AES 运算。最后,密文接收者会收到密文、IV(计数器 CTR 的初始值)、MAC 值。 
# Android cryptography > ref: https://developer.android.com/guide/topics/security/cryptography 
## 排查 [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)                 
# [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...