public override bool VerifySignature(byte[] documentToSign, byte[] signature, string publicKey)
        {
            var pubKey = BouncyKeyFactory.FromPublicKeyString(publicKey);

            var signer = SignerUtilities.GetSigner(signatureAlgorithm);

            signer.Init(false, pubKey);
            signer.BlockUpdate(documentToSign, 0, documentToSign.Length);

            return(signer.VerifySignature(signature));
        }
        public override byte[] Sign(byte[] documentToSign, string privateKey, string passPhrase)
        {
            var privKey = BouncyKeyFactory.FromEncryptedPrivateKeyString(privateKey, passPhrase);

            var signer = SignerUtilities.GetSigner(signatureAlgorithm);

            signer.Init(true, privKey);
            signer.BlockUpdate(documentToSign, 0, documentToSign.Length);
            var signature = signer.GenerateSignature();

            return(signature);
        }
 /// <summary>
 /// Gets the DER encoded public key.
 /// </summary>
 /// <returns>The public key.</returns>
 public override string ToPublicKeyString()
 {
     return(BouncyKeyFactory.ToPublicKeyString(keyPair.Public));
 }
 /// <summary>
 /// Gets the encrypted and DER encoded private key.
 /// </summary>
 /// <param name="passPhrase">The pass phrase to encrypt the private key.</param>
 /// <returns>The encrypted private key.</returns>
 public override string ToEncryptedPrivateKeyString(string passPhrase)
 {
     return(BouncyKeyFactory.ToEncryptedPrivateKeyString(keyPair.Private, passPhrase));
 }