回目录 《区块链:密码学基础》

更基础的是:公钥基础设施

# Basic

我写的一个工具:

https://www.tokenscript.org/t/demo-tool-for-express-of-trust/235

Weierstrass equation

https://en.wikipedia.org/wiki/Elliptic_curve

ecc commutative associative

https://pdfs.semanticscholar.org/ab40/c9d62b65a27179eab8e0f0f654170c2540bd.pdf

A set G is called an abelian group (G, ) with a binary operation : GG --> G if it satisfies the following properties:

  • Associativity: (ab)c=a(bc) for all a,b,c ∈G .
  • Commutativity: ab=ba for all a,b, ∈G .
  • Identity: there exists i∈G such that ai = ia=a for all a ∈G .
  • Inverse: for each a∈G , there exists b∈G such that ab=ba=i . Element b is called the inverse of a.

The group is called additive or multiplicative if the binary operation is called addition (+) or multiplication (*), respectively. For the first case, the identity element is usually denoted by 0, and the additive inverse of an element a, by –a. For the second case, the identity element is usually denoted by 1, and the multiplicative inverse of an element a, by a^-1 .

# RSA到ECC椭圆算法

A (relatively easy to understand) primer on elliptic curve cryptography https://arstechnica.com/information-technology/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/ 一个关于椭圆曲线密码学的初级读本(相当容易懂) 8btc.com/thread-1240-1-1.html 跨越千年的RSA算法 www.matrix67.com/blog/archives/5100 RSA加密学习的简单例子 https://blog.csdn.net/dianqu6970/article/details/76527572 RSA算法演绎 www.voidcn.com/article/p-kwtzevgb-bpo.html ECC加密算法入门介绍 https://www.pediy.com/kssd/pediy06/pediy6014.htm Martijn Grooten - Elliptic Curve Cryptography for those who are afraid of maths https://www.youtube.com/watch?v=yBr3Q6xiTw4 Elliptic Curve Cryptography Tutorial - Understanding ECC through the Diffie-Hellman Key Exchange https://www.youtube.com/watch?v=gAtBM06xwaw

# ETH

Hash function Keccak? Keccak-256? Sha3? To make it clearer that Ethereum uses KECCAK-256 instead of the NIST standardized SHA-3 hash function, Solidity 0.4.3 has introduced keccak256. (It is an alias to sha3, meaning that keccak256 produces identical results to sha3, but with the intent to avoid confusion, especially for developers new to Ethereum.) It's recommended that new code use keccak256 instead of sha3 Rename/alias sha3 to minimize confusion with SHA-3 standard https://github.com/ethereum/EIPs/issues/59

# BTC

HASH160

# Use Case

# Openssl generate ETH keypair

# sign xml using Eth private key

Eckeypair => x509 crt => sign xml with xmlsectool

Issue:

  1. Private key string to eckeypair
  2. Eckeypair to java keypair BCECPrivateKey
  3. Generate x509 crt programmatically
  4. Add xmlsectool jar to sign with crt

https://www.programcreek.com/java-api-examples/?code=papyrusglobal/state-channels/state-channels-master/channel-node/src/main/java/papyrus/channel/node/server/NodeServer.java#

https://github.com/vibhudadhichi/state-channels

PKCS12 PKCS8?

X509V1CertificateGenerator "bc" bouncyCastleProvider

https://github.com/web3j/web3j/blob/master/crypto/src/main/java/org/web3j/crypto/ECKeyPair.java

Java KeyPair => ECKeyPair public static ECKeyPair create(KeyPair keyPair) {

How to use .key and .crt file in java that generated by openssl? https://stackoverflow.com/questions/6482484/how-to-use-key-and-crt-file-in-java-that-generated-by-openssl

Refer: Creating X.509 certificates programmatically in Java https://www.mayrhofer.eu.org/create-x509-certs-in-java

Generate x509 http://cr.openjdk.java.net/~rhalade/8049237/webrev.01/test/sun/security/x509/X509CertImpl/V3Certificate.java.html

BouncyCastle error: can't recognise key type in ECDSA based signer https://stackoverflow.com/questions/5978537/bouncycastle-error-cant-recognise-key-type-in-ecdsa-based-signer 基于BouncyCastle的ECDSA Key, CSR, Certificate Demo http://enuocm.iteye.com/blog/2359347 HOW TO GENERATE X.509 CERTIFICATE IN JAVA 1.8 https://hecpv.wordpress.com/2017/03/18/how-to-generate-x-509-certificate-in-java-1-8/ PEM encoding of ECDSA in Java https://stackoverflow.com/questions/47777264/pem-encoding-of-ecdsa-in-java

Creating an X509 Certificate in Java without BouncyCastle? https://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle

Cryptography with Python https://samsclass.info/124/Defcon-BSidesLV-2016-crypto.shtml