更新npm后,我无法npm install运行
npm install
Run Code Online (Sandbox Code Playgroud)
我有
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './lib/extract-stream.js'
Run Code Online (Sandbox Code Playgroud)
的位置extract-stream.js是/usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js
如果我跑步
/usr/local/bin/npm install # IT WORKS!
Run Code Online (Sandbox Code Playgroud)
当我跑步
which npm
# output: {my_home_path}/.npm-global/bin/npm
Run Code Online (Sandbox Code Playgroud)
当我跑步时
npm -v
# output: 6.7.0
/usr/local/bin/npm -v
# output 6.5.0
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
sdkmanager我无法在带有 java11 的 macOS 上运行。
当我运行时$ANDROID_HOME/tools/bin/sdkmanager出现此错误
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more```
Run Code Online (Sandbox Code Playgroud) 在我的场景中,Alice 和 Bob 就使用哪条曲线达成了一致。
我的问题是 Alice 的公钥实际上是一个点,因此它具有 xy 格式。
我需要将 x,y 坐标字节转换为 ECPublicKey。
这是我正在使用的源代码
// outerPublicKey is the raw bytes from x,y coordinates in hex format
KeyFactory kf = KeyFactory.getInstance("EC");
PublicKey remoteAlicePub = kf.generatePublic(new X509EncodedKeySpec(outerPublicKey));
KeyPairGenerator bobKeyGen = KeyPairGenerator.getInstance("ECDH", "BC");
bobKeyGen.initialize(new ECGenParameterSpec(properties.getCurveName()), new SecureRandom());
KeyPair bobPair = bobKeyGen.generateKeyPair();
ECPublicKey bobPub = (ECPublicKey)bobPair.getPublic();
ECPrivateKey bobPvt = (ECPrivateKey)bobPair.getPrivate();
byte[] bobPubEncoded = bobPub.getEncoded();
byte[] bobPvtEncoded = bobPvt.getEncoded();
KeyAgreement bobKeyAgree = KeyAgreement.getInstance("ECDH");
bobKeyAgree.init(bobPvt);
bobKeyAgree.doPhase(remoteAlicePub, true); …Run Code Online (Sandbox Code Playgroud) 我尝试通过从给定数字(我的私钥)计算曲线上的点来创建椭圆公钥,所以我有(x,y)椭圆曲线点的坐标
我得到坐标
myPublicKeyCoordinates = myPrivateKeyValue * GPointOnCurve
Run Code Online (Sandbox Code Playgroud)
如何为我的公钥构建PEM( 或DER) 文件?
我不在乎语言(java, python, javascript, ...),
因为我想知道如何构建文件(即使我写了每个字节......)
我正在 Elasticsearch 上创建一个查询,用于通过所有索引查找文档。
我需要在 Elasticsearch 上结合 should、must 和嵌套查询,我得到了正确的结果,但在结果中出现了错误。
这是我正在使用的查询
GET _all/_search
{
"query": {
"bool": {
"minimum_should_match": 1,
"should": [
{ "term": { "trimmed_final_url": "https://www.repubblica.it/t.../" } }
],
"must": [
{
"nested": {
"path": "entities",
"query": {
"bool": {
"must": [
{ "term": { "entities.id": "138511" } }
]
}
}
}
},
{
"term": {
"language": { "value": "it" }
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
这就是结果
{
"_shards" : {
"total" : 38,
"successful" : 14,
"skipped" : 0, …Run Code Online (Sandbox Code Playgroud) macos ×2
adb ×1
android ×1
bouncycastle ×1
ecdh ×1
java ×1
java-11 ×1
nested ×1
node.js ×1
npm ×1
npm-install ×1
public-key ×1
secret-key ×1