使用对称密钥(AES -128)签名和验证消息 [英] Using symmetric key (AES -128) to sign and verify a message

查看:296
本文介绍了使用对称密钥(AES -128)签名和验证消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道可以使用对称密钥来签署邮件吗?我们可以使用共享的密钥encrpyt。同样当使用对称密钥进行签名时,在JAVA中可以使用什么API来加载密钥并签名消息?

如果我使用java.security中的Signature,有一个api initSign,但是从公共/私有密钥对的私钥作为参数签名消息。

解决方案



共享密钥可用于计算邮件验证码(MAC),然后可用于确认完整性以及消息的真实性到知道相同的共享秘密的另一方。与使用私钥创建并使用公钥验证的数字签名不同,MAC不提供不可否认性(任何可以验证MAC的人也可以为另一个消息生成MAC)。



有不同形式的消息认证码;可能最常使用的版本是 HMAC


I want to know can symmetric keys be used to sign a message ? We can encrpyt using the shared secret key. Also when symmetric key is used for signing , what API can be used in JAVA to load the key and sign the message ?

if i used Signature from java.security , it has an api initSign but that takes private key from the public/private key pair as the argument to sign the message. Here the key is symmetric key.

Any pointers ?

解决方案

A shared secret key can be used to calculate a Message Authentication Code (MAC), which then can be used to confirm the integrity and authenticity of the message to another party which knows the same shared secret. Unlike digital signatures, which are created using the private key and verified using the public key, MACs do not offer non-repudiation (anyone who can verify the MAC can also generate a MAC for another message).

There are different forms of message authentication codes; probably the most often used variation is HMAC.

这篇关于使用对称密钥(AES -128)签名和验证消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆