問題タブ [pynacl]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - Finding corresponding PyNaCL functions in libsodium (C#)
I am using a python rest server (which I found here: https://github.com/xxblx/tornado-app-template) that supports access tokens and lets a client sign the access tokens. The repository contains a python client that creates a SigningKey on the client side. The provided code shows how to create the required keys and hashes required to create a user that is later able to sign tokens.
I want to write a C# client that can generate a SigningKey and is capable of signing the tokens in the same way. I am using libsodium 1.0.16 for my client and I am having trouble creating an equivalent keypair, not to mention finding the corresponding function for creating the password_hash or the key in the above code. I am not even sure which functions to use for the key creation. From my small understanding of crypto, I assume that it should be possible. Any help regarding finding the correct libsodium function for the above used nacl functions (nacl.hash.blake2b, nacl.secret.SecretBox(key), nacl.pwhash.argon2i.kdf(...), etc) or a hint for creating an equivalent SigningKey would be great.
My approach in C# using libsodium to create this public and secret key looks like this:
Is this a good start?
python - Python を使用して nacl SigningKey の公開鍵と秘密鍵をプレーン テキストとして保存する方法は?
nacl docsに何かが欠けているに違いありません。秘密鍵と公開鍵の両方をプレーン テキストで保存するにはどうすればよいですか? 使用可能なエンコーダーは、Raw (バイナリー?)、Hex、Base16/32/64、および URLSafeBase64Encoder です。
base64
このライブラリを使用して、Base64 でエンコードされたキーを変換するだけだと思っていました。
例:
結果: Bytes オブジェクト
試した:
- ここの
Decoding Strings with Python
チュートリアル、およびあらゆる種類のバリエーション。 - それらのいずれも、プレーンテキストバージョンの
SigningKey
-----BEGIN OPENSSH PRIVATE KEY-----
などをプレーンテキストで探していますb64decode
関数にプレーンテキストを表示させるにはどうすればよいですか?