我想我应该发布这个问题,即使我已经找到了解决方案,因为当我搜索它时,Java实现并不容易获得.
使用HSV代替RGB可以生成具有相同饱和度和亮度的颜色(我想要的东西).
Google App Engine不允许使用java.awt.Color,因此执行以下操作以在HSV和RGB之间进行转换不是一个选项:
Color c = Color.getHSBColor(hue, saturation, value);
String rgb = Integer.toHexString(c.getRGB());
Run Code Online (Sandbox Code Playgroud)
编辑:我按照尼克约翰逊的评论中的描述移动了我的答案.
前animo, - 亚历山大.
通过最新的Windows周年更新,Edge现在支持使用Windows Hello进行生物识别身份验证(参见https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/dev-guide/device/web-authentication / ,https://blogs.windows.com/msedgedev/2016/04/12/a-world-without-passwords-windows-hello-in-microsoft-edge/)
我在C#,PHP和Node.js中有一些示例,我试图让它在Go中运行.
以下在JS中工作(我在挑战和密钥中硬编码):
function parseBase64(s) {
s = s.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, '');
return new Uint8Array(Array.prototype.map.call(atob(s), function (c) { return c.charCodeAt(0) }));
}
function concatUint8Array(a1,a2) {
var d = new Uint8Array(a1.length + a2.length);
d.set(a1);
d.set(a2,a1.length);
return d;
}
var credAlgorithm = "RSASSA-PKCS1-v1_5";
var id,authenticatorData,signature,hash;
webauthn.getAssertion("chalenge").then(function(assertion) {
id = assertion.credential.id;
authenticatorData = assertion.authenticatorData;
signature = assertion.signature;
return crypto.subtle.digest("SHA-256",parseBase64(assertion.clientData));
}).then(function(h) {
hash = new Uint8Array(h);
var publicKey = "{\"kty\":\"RSA\",\"alg\":\"RS256\",\"ext\":false,\"n\":\"mEqGJwp0GL1oVwjRikkNfzd-Rkpb7vIbGodwQkTDsZT4_UE02WDaRa-PjxzL4lPZ4rUpV5SqVxM25aEIeGkEOR_8Xoqx7lpNKNOQs3E_o8hGBzQKpGcA7de678LeAUZdJZcnnQxXYjNf8St3aOIay7QrPoK8wQHEvv8Jqg7O1-pKEKCIwSKikCFHTxLhDDRo31KFG4XLWtLllCfEO6vmQTseT-_8OZPBSHOxR9VhIbY7VBhPq-PeAWURn3G52tQX-802waGmKBZ4B87YtEEPxCNbyyvlk8jRKP1KIrI49bgJhAe5Mow3yycQEnGuPDwLzmJ1lU6I4zgkyL1jI3Ghsw\",\"e\":\"AQAB\"}";
return crypto.subtle.importKey("jwk",JSON.parse(publicKey),credAlgorithm,false,["verify"]);
}).then(function(key) {
return crypto.subtle.verify({name:credAlgorithm, hash: { …Run Code Online (Sandbox Code Playgroud)