Identity
IC4J Java Agent currently supports 3 different identity mechanisms. To learn more about the Internet Computer identity mechanisms refer to the Dfinity documentation.
IC4J Agent uses the open source Java cryptography library Bouncy Castle in its implementation.
If BasicIndentity or Secp256k1Identity is being used, define Bouncy Castle as the Java security provider in the code, before an Identity is created.
AnonymousIdentity
AnonymousIdentity is the default mechanism in the IC4J Agent ; this means that if the identity is not specified explicitly , AnonymousIdentity will be assigned implicitly.
To explicitly create the AnonymousIdentity object, the AnonymousIdentity Constructor can be used.
BasicIdentity (ED25519)
The Internet Computer provides support for ED25519 signatures. The dfx tool can be used to generate the identity PEM file.
Either the Java Reader or Java Path can be used to read the ED22219 PEM resource to create the BasicIdentity object.
Another option is to use Java KeyPair as an input parameter.
The Java byte[] array can also be used as an input parameter.
Secp256k1Identity
The Internet Computer also supports Secp256k1 signatures commonly used with Bitcoin or Ethereum.
Either Java Reader or Java Path can be used to read the Secp256k1 PEM resource to create the Secp256k1Identity object.
Another option is to use Java KeyPair as an input parameter.
To see a fully functional Java sample with all 3 Identity mechanisms refer to this Github sample.
Last updated