我在Android N中阅读了关于新的密钥证明API并希望测试它但我缺少一些类.
关键证明在此处描述:https://developer.android.com/preview/features/key-attestation.html
在剪切的第一个代码中,使用了在将targetAPI设置为API 24时找不到的Attestation类.
Attestation hardwareKeyAttestation = new Attestation(attestationCert);
Run Code Online (Sandbox Code Playgroud)
我在这里想念什么吗?我需要专有库吗?
我使用Tomcat 7和Lo4j作为我的所有服务器日志,使用GWT作为客户端(仅限AJAX调用).所有未处理的异常都记录在我的catalina.log中.
现在我想捕获所有异常并添加一些用户特定的Tomcat SessionData.
有几种方法:
实现这一目标的最佳方法是什么?
我需要NIST P-256曲线的固定长度64字节ECDSA签名。
实现不必使用JCE。
下面的代码示例可以生成一个签名并进行验证。
Provider provSign = new SunEC();
Provider provVerify = new SunEC();
// generate EC key
KeyPairGenerator kg = KeyPairGenerator.getInstance("EC", provSign);
ECGenParameterSpec ecParam = new ECGenParameterSpec("secp256r1");
kg.initialize(ecParam);
KeyPair keyPair = kg.generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
PublicKey publicKey = keyPair.getPublic();
try
{
// export public key
KeyFactory kf = KeyFactory.getInstance("EC", provSign);
ECPublicKeySpec publicKeySpec = kf.getKeySpec(keyPair.getPublic(), ECPublicKeySpec.class);
// import public key into other provider
kf = KeyFactory.getInstance("EC", provVerify);
publicKey = (PublicKey)kf.generatePublic(publicKeySpec);
}
catch (InvalidKeySpecException ex)
{
ex.printStackTrace();
}
// do …Run Code Online (Sandbox Code Playgroud) 我有以下 JSON 数据:
[
{
"unique1":{
"value":3
}
},
{
"unique2":{
"value":4
}
}
]
Run Code Online (Sandbox Code Playgroud)
每个数组项都有一个 json 对象,该对象具有一个顶级唯一键。当我尝试为其编写验证模式时,我只能验证整个数组是否唯一,而不能验证每个数组中的顶级键。
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"patternProperties": {
"^.*$": {
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
以下 JSON 数据应该无法验证:
[
{
"unique1":{
"value":3
}
},
{
"unique1":{
"value":4
}
}
]
Run Code Online (Sandbox Code Playgroud) java ×2
android ×1
cryptography ×1
ecdsa ×1
gwt ×1
jce ×1
json ×1
jsonschema ×1
security ×1
tee ×1
tomcat ×1
validation ×1