Class BcSignatureService
java.lang.Object
org.xrpl.xrpl4j.crypto.signing.AbstractSignatureService<PrivateKey>
org.xrpl.xrpl4j.crypto.signing.bc.BcSignatureService
- All Implemented Interfaces:
SignatureService<PrivateKey>,TransactionSigner<PrivateKey>,TransactionVerifier
public class BcSignatureService
extends AbstractSignatureService<PrivateKey>
implements SignatureService<PrivateKey>
A SignatureService that uses BouncyCastle internally to sign with an in-memory instance of
PrivateKey.
WARNING: This implementation utilizes in-memory private-key material. Consider instead using a
SignatureService that uses instance of PrivateKeyReference for improved security.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRequired-args Constructor for use in development mode.BcSignatureService(SignatureUtils signatureUtils, org.bouncycastle.crypto.signers.Ed25519Signer ed25519Signer, org.bouncycastle.crypto.signers.ECDSASigner ecdsaSigner) Required-args Constructor. -
Method Summary
Modifier and TypeMethodDescriptionderivePublicKey(PrivateKey privateKey) Helper method to derive a public key from a private key.protected SignatureecDsaSign(PrivateKey privateKey, UnsignedByteArray transactionBytes) Does the actual work of computing a signature using a secp256k1 private-key, as locatable usingprivateKey.protected booleanecDsaVerify(PublicKey publicKey, UnsignedByteArray transactionBytes, Signature signature) Verify a signature.protected SignatureedDsaSign(PrivateKey privateKey, UnsignedByteArray signableTransactionBytes) Does the actual work of computing a signature using a ed25519 private-key, as locatable usingprivateKey.protected booleanedDsaVerify(PublicKey publicKey, UnsignedByteArray transactionBytes, Signature signature) Verify a signature.Methods inherited from class org.xrpl.xrpl4j.crypto.signing.AbstractSignatureService
multiSign, multiSignInner, sign, sign, sign, signInner, verify, verifyMultiSignedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xrpl.xrpl4j.crypto.signing.TransactionSigner
multiSign, multiSignInner, multiSignToSigner, sign, sign, sign, signInnerMethods inherited from interface org.xrpl.xrpl4j.crypto.signing.TransactionVerifier
verify, verifyMultiSigned, verifyMultiSigned
-
Constructor Details
-
BcSignatureService
public BcSignatureService()Required-args Constructor for use in development mode. -
BcSignatureService
public BcSignatureService(SignatureUtils signatureUtils, org.bouncycastle.crypto.signers.Ed25519Signer ed25519Signer, org.bouncycastle.crypto.signers.ECDSASigner ecdsaSigner) Required-args Constructor.- Parameters:
signatureUtils- AnSignatureUtils.ed25519Signer- AnEd25519Signer.ecdsaSigner- AnECDSASigner.
-
-
Method Details
-
edDsaSign
Description copied from class:AbstractSignatureServiceDoes the actual work of computing a signature using a ed25519 private-key, as locatable usingprivateKey.- Specified by:
edDsaSignin classAbstractSignatureService<PrivateKey>- Parameters:
privateKey- AAbstractSignatureServiceused for signing.signableTransactionBytes- AUnsignedByteArrayto sign.- Returns:
- A
Signaturewith data that can be used to submit a transaction to the XRP Ledger.
-
ecDsaSign
Description copied from class:AbstractSignatureServiceDoes the actual work of computing a signature using a secp256k1 private-key, as locatable usingprivateKey.- Specified by:
ecDsaSignin classAbstractSignatureService<PrivateKey>- Parameters:
privateKey- AAbstractSignatureServiceused for signing.transactionBytes- AUnsignedByteArrayto sign.- Returns:
- A
Signaturewith data that can be used to submit a transaction to the XRP Ledger.
-
edDsaVerify
protected boolean edDsaVerify(PublicKey publicKey, UnsignedByteArray transactionBytes, Signature signature) Description copied from class:AbstractSignatureServiceVerify a signature.- Specified by:
edDsaVerifyin classAbstractSignatureService<PrivateKey>- Parameters:
publicKey- ThePublicKeyused to verify the signed transaction.transactionBytes- AnUnsignedByteArraycontaining the bytes of the transaction that was signed.signature- ASignatureover the transaction.- Returns:
trueif the signature is valid;falseotherwise.
-
ecDsaVerify
protected boolean ecDsaVerify(PublicKey publicKey, UnsignedByteArray transactionBytes, Signature signature) Description copied from class:AbstractSignatureServiceVerify a signature.- Specified by:
ecDsaVerifyin classAbstractSignatureService<PrivateKey>- Parameters:
publicKey- APublicKey.transactionBytes- AnUnsignedByteArraycontaining the bytes of the transaction that was signed.signature- ASignatureover the transaction.- Returns:
trueif the signature is valid;falseotherwise.
-
derivePublicKey
Description copied from class:AbstractSignatureServiceHelper method to derive a public key from a private key.- Specified by:
derivePublicKeyin interfaceTransactionSigner<PrivateKey>- Specified by:
derivePublicKeyin classAbstractSignatureService<PrivateKey>- Parameters:
privateKey- An instance ofPrivateKey.- Returns:
- A corresponding
PublicKey.
-