public class EOSFormatter
extends java.lang.Object
| Constructor and Description |
|---|
EOSFormatter() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull java.lang.String |
convertDERSignatureToEOSFormat(@NotNull byte[] signatureDER,
@NotNull byte[] signableTransaction,
@NotNull java.lang.String publicKeyPEM)
This method converts a signature to a EOS compliant form.
|
static @NotNull java.lang.String |
convertEOSPrivateKeyToPEMFormat(@NotNull java.lang.String privateKeyEOS)
This method converts an EOS formatted private key to the PEM format.
|
static @NotNull java.lang.String |
convertEOSPublicKeyToPEMFormat(@NotNull java.lang.String publicKeyEOS)
This method converts an EOS formatted public key to the PEM format.
|
static @NotNull java.lang.String |
convertPEMFormattedPrivateKeyToEOSFormat(@NotNull java.lang.String privateKeyPEM)
This method converts a PEM formatted private key to the EOS format.
|
static @NotNull java.lang.String |
convertPEMFormattedPublicKeyToEOSFormat(@NotNull java.lang.String publicKeyPEM,
boolean requireLegacyFormOfSecp256k1Key)
This method converts a PEM formatted public key to the EOS format.
|
static @NotNull java.lang.String |
convertRawRandSofSignatureToEOSFormat(@NotNull java.lang.String signatureR,
java.lang.String signatureS,
@NotNull byte[] signableTransaction,
@NotNull java.lang.String publicKeyPEM)
This method converts a signature to a EOS compliant form.
|
static @NotNull byte[] |
decodePublicKey(@NotNull java.lang.String strKey,
java.lang.String keyPrefix)
Base58 decodes a public key and validates checksum.
|
static @NotNull java.lang.String |
encodePrivateKey(@NotNull byte[] pemKey,
@NotNull AlgorithmEmployed keyType)
Base58 encodes a private key after calculating and appending the checksum.
|
static @NotNull java.lang.String |
encodePublicKey(@NotNull byte[] pemKey,
@NotNull AlgorithmEmployed keyType,
boolean isLegacy)
Encoding PEM public key to EOS format.
|
static java.lang.String |
extractSerializedTransactionFromSignable(@NotNull java.lang.String eosTransaction)
Extract serialized transaction from a signable transaction
|
static java.lang.String |
prepareSerializedTransactionForSigning(@NotNull java.lang.String serializedTransaction,
@NotNull java.lang.String chainId)
Preparing signable transaction for signing.
|
@NotNull
public static @NotNull java.lang.String convertPEMFormattedPublicKeyToEOSFormat(@NotNull
@NotNull java.lang.String publicKeyPEM,
boolean requireLegacyFormOfSecp256k1Key)
throws EOSFormatterError
publicKeyPEM - Public key in the PEM formatrequireLegacyFormOfSecp256k1Key - - If the developer prefers a legacy version of a
secp256k1 key that uses a "EOS" prefix.EOSFormatterError - if PEM conversion to EOS format fails.@NotNull
public static @NotNull java.lang.String convertEOSPublicKeyToPEMFormat(@NotNull
@NotNull java.lang.String publicKeyEOS)
throws EOSFormatterError
publicKeyEOS - Public key in the EOS formatEOSFormatterError - if EOS conversion to PEM format fails.@NotNull
public static @NotNull java.lang.String convertDERSignatureToEOSFormat(@NotNull
@NotNull byte[] signatureDER,
@NotNull
@NotNull byte[] signableTransaction,
@NotNull
@NotNull java.lang.String publicKeyPEM)
throws EOSFormatterError
signatureDER - ECDSA DER encoded signature as byte arraysignableTransaction - Transaction in signable formatpublicKeyPEM - public key in PEM formatEOSFormatterError - if DER conversion to EOS format fails.@NotNull
public static @NotNull java.lang.String convertRawRandSofSignatureToEOSFormat(@NotNull
@NotNull java.lang.String signatureR,
java.lang.String signatureS,
@NotNull
@NotNull byte[] signableTransaction,
@NotNull
@NotNull java.lang.String publicKeyPEM)
throws EOSFormatterError
signatureR - R value as BigInteger in string formatsignatureS - S value as BigInteger in string formatsignableTransaction - Transaction in signable formatpublicKeyPEM - Public Key used to sign in PEM formatEOSFormatterError - if conversion to EOS format fails.@NotNull
public static @NotNull java.lang.String convertPEMFormattedPrivateKeyToEOSFormat(@NotNull
@NotNull java.lang.String privateKeyPEM)
throws EOSFormatterError
privateKeyPEM - Private key in PEM formatEOSFormatterError - if PEM conversion to EOS format fails.@NotNull
public static @NotNull java.lang.String convertEOSPrivateKeyToPEMFormat(@NotNull
@NotNull java.lang.String privateKeyEOS)
throws EOSFormatterError
privateKeyEOS - Private key in EOS formatEOSFormatterError - if EOS conversion to PEM format fails.public static java.lang.String extractSerializedTransactionFromSignable(@NotNull
@NotNull java.lang.String eosTransaction)
throws EOSFormatterError
Signable signature structure:
chainId (64 characters) + serialized transaction + 32 bytes of 0
eosTransaction - - the input signable transactionEOSFormatterError - if input is invalidpublic static java.lang.String prepareSerializedTransactionForSigning(@NotNull
@NotNull java.lang.String serializedTransaction,
@NotNull
@NotNull java.lang.String chainId)
throws EOSFormatterError
Signable signature structure:
chainId + serialized transaction + 32 bytes of 0
serializedTransaction - - the serialized transaction to be converted to signable transactionchainId - - the chain id will be used inside the signature transaction structure.EOSFormatterError - if inputs are invalid@NotNull
public static @NotNull java.lang.String encodePrivateKey(@NotNull
@NotNull byte[] pemKey,
@NotNull
@NotNull AlgorithmEmployed keyType)
throws Base58ManipulationError
pemKey - - Private key as byte[] to encodekeyType - - input key typeBase58ManipulationError - it private key encoding fails.@NotNull
public static @NotNull java.lang.String encodePublicKey(@NotNull
@NotNull byte[] pemKey,
@NotNull
@NotNull AlgorithmEmployed keyType,
boolean isLegacy)
throws Base58ManipulationError
pemKey - - PEM key as byte[] to encodekeyType - - Algorithm type used to create keyisLegacy - - If the developer prefers a legacy version of a secp256k1 key that uses an
"EOS" prefix.Base58ManipulationError - if public key encoding fails.@NotNull
public static @NotNull byte[] decodePublicKey(@NotNull
@NotNull java.lang.String strKey,
java.lang.String keyPrefix)
throws Base58ManipulationError
strKey - Base58 encoded public key in string format.keyPrefix - EOS specific key type prefix (i.e. PUB_R1_, PUB_K1_, or EOS).Base58ManipulationError - if public key decoding fails.