使用带有足够安全盐的 AES 加密
Is using the AES crypto with a salt secure enough
我在查看一些 GitHub 代码时看到了这样一个函数:
function computeHash(password, salt, fn) {
// Bytesize
var len = 128;
var iterations = 4096;
if (3 == arguments.length) {
crypto.pbkdf2(password, salt, iterations, len, fn);
} else {
fn = salt;
crypto.randomBytes(len, function(err, salt) {
if (err) return fn(err);
salt = salt.toString('base64');
crypto.pbkdf2(password, salt, iterations, len, function(err, derivedKey) {
if (err) return fn(err);
fn(null, salt, derivedKey.toString('base64'));
});
});
}
}
上面的代码在 JS lamba 函数中是这样调用的:
exports.handler = function(event, context) {
v ar email = event.email;
var clearPassword = event.password;
computeHash(clearPassword, function(err, salt, hash) { ...
这是一种足够安全的方法吗
我如何使用 SSL 将数据从 iphone 获取到 lambda(是否有在 AWS 中启用它的简单方法)?
关于computeHash()函数,它使用的是salted hashes which is a standard and reasonably secure means of storing passwords. See https://security.stackexchange.com/questions/47183/is-it-safe-to-use-pbkdf2-for-hashing。正如@RobNapier 所说,您的里程可能会有所不同。
要从您的设备获取 Lambda 函数的密码,请使用 AWS API Gateway and Lambda:
AWS Lambda provides an easy way to build back ends without managing
servers. API Gateway and Lambda together can be powerful to create and
deploy serverless Web applications. In this walkthrough, you learn how
to create Lambda functions and build an API Gateway API to enable a
Web client to call the Lambda functions synchronously.
在 Lambda 中,您可以轻松地创建一个 API 端点 URL 来公开您的函数。 API 端点默认使用 HTTPS 协议,因此已提供 SSL。
我在查看一些 GitHub 代码时看到了这样一个函数:
function computeHash(password, salt, fn) {
// Bytesize
var len = 128;
var iterations = 4096;
if (3 == arguments.length) {
crypto.pbkdf2(password, salt, iterations, len, fn);
} else {
fn = salt;
crypto.randomBytes(len, function(err, salt) {
if (err) return fn(err);
salt = salt.toString('base64');
crypto.pbkdf2(password, salt, iterations, len, function(err, derivedKey) {
if (err) return fn(err);
fn(null, salt, derivedKey.toString('base64'));
});
});
}
}
上面的代码在 JS lamba 函数中是这样调用的:
exports.handler = function(event, context) {
v ar email = event.email;
var clearPassword = event.password;
computeHash(clearPassword, function(err, salt, hash) { ...
这是一种足够安全的方法吗 我如何使用 SSL 将数据从 iphone 获取到 lambda(是否有在 AWS 中启用它的简单方法)?
关于computeHash()函数,它使用的是salted hashes which is a standard and reasonably secure means of storing passwords. See https://security.stackexchange.com/questions/47183/is-it-safe-to-use-pbkdf2-for-hashing。正如@RobNapier 所说,您的里程可能会有所不同。
要从您的设备获取 Lambda 函数的密码,请使用 AWS API Gateway and Lambda:
AWS Lambda provides an easy way to build back ends without managing servers. API Gateway and Lambda together can be powerful to create and deploy serverless Web applications. In this walkthrough, you learn how to create Lambda functions and build an API Gateway API to enable a Web client to call the Lambda functions synchronously.
在 Lambda 中,您可以轻松地创建一个 API 端点 URL 来公开您的函数。 API 端点默认使用 HTTPS 协议,因此已提供 SSL。