Click or drag to resize

RsaDigitalSignatureSerializer Class

Serializer digitaly signing data.
Inheritance Hierarchy

Namespace:  Eneter.Messaging.DataProcessing.Serializing
Assembly:  Eneter.Messaging.Framework (in Eneter.Messaging.Framework.dll) Version: (
public class RsaDigitalSignatureSerializer : ISerializer

The RsaDigitalSignatureSerializer type exposes the following members.

Public methodDeserialize_T
Deserializes data.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSerialize_T
Serializes data.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
  1. Incoming data is serialized by underlying serializer (e.g. XmlStringSerializer)
  2. SHA1 hash is calculated from the serialized data.
  3. The hash is encrypted with RSA using the private key.
  4. The serialized data consists of serialized data, encoded hash (signature) and public certificate of the signer.
  1. The public certificate is taken from serialized data and verified. (you can provide your own verification)
  2. SHA1 hash is calculated from serialized data.
  3. Encrypted hash (signature) is decrypted by public key taken from the certificate.
  4. If the decrypted hash is same as calculated one the data is ok.
  5. Data is deserialized by the underlying serializer and returned.
Example shows how to serialize/deserialize data using digital signature.
// Get the certificate containing public and private keys. E.g. from the file.
X509Certificate2 aSignerCertificate = new X509Certificate2("c:/MyCertificate.pfx", "mypassword");

// Create the serializer.
RsaDigitalSignatureSerializer aSerializer = new RsaDigitalSignatureSerializer(aSignerCertificate);

// Serialize data.
// (serialized data will contain digital signature and signer's public certificate)
object aSerializedData = aSerializer.Serialize<string>("Hello world.");

// Deserialize data.
string aDeserializedData = aSerializer.Deserialize<string>(aSerializedData);
See Also