Class EbicsPubKeyInfo
A public RSA key.
Implements
Inherited Members
Namespace: Subsembly.EBICS
Assembly: Subsembly.EBICS.Core.dll
Syntax
public class EbicsPubKeyInfo : EbicsElement, IEbicsJsonConverter
Properties
Exponent
The common exponent
Declaration
public EbicsDataBuffer Exponent { get; set; }
Property Value
Type | Description |
---|---|
EbicsDataBuffer |
Modulus
The public modulus.
Declaration
public EbicsDataBuffer Modulus { get; set; }
Property Value
Type | Description |
---|---|
EbicsDataBuffer |
ModulusBitLength
The number of significant bits in the Modulus.
Declaration
public int ModulusBitLength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PubKeyDigestAlgorithm
Declaration
public string PubKeyDigestAlgorithm { get; }
Property Value
Type | Description |
---|---|
System.String |
TimeStamp
Optional time of key generation.
Declaration
public DateTime TimeStamp { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The value DateTime.MinValue indicates that no date is set. |
Remarks
This corresponds to the XML element ebics:TimeStamp.
Version
The security operation and version.
Declaration
public EbicsSecurityCode Version { get; set; }
Property Value
Type | Description |
---|---|
EbicsSecurityCode |
Remarks
This corresponds to (and actually selects) one of the XML elements ebics:AuthenticationVersion, ebics:SignatureVersion, or ebics:EncryptionVersion.
X509Certificate
The X.509 certificate for this key. This is optional before EBICS 3.0, and mandatory starting with EBICS 3.0. It is always needed for French EBICS implementations.
Declaration
public EbicsDataBuffer X509Certificate { get; set; }
Property Value
Type | Description |
---|---|
EbicsDataBuffer |
Remarks
If no certificate was issued for the user keys, then a self-signed certificate can be used by calling CreateSelfSignedCertificate(EbicsPrivKey, String) before submitting user keys.
Just parsing the EbicsPubKeyInfo does not validate the authority signature of this certificate.
See Also
Methods
BuildPubKeyDigest(String)
Builds a public key digest element
Declaration
public EbicsPubKeyDigest BuildPubKeyDigest(string sRootTag)
Parameters
Type | Name | Description |
---|---|---|
System.String | sRootTag | The root tag to be used for the returned element. This is usually one of "EncryptionPubKeyDigest", "Authentication", or "Encryption". |
Returns
Type | Description |
---|---|
EbicsPubKeyDigest |
Remarks
The returned element has a "Version" and an "Algorithm" attribute. The value of these attributes are derived from the Version of this public key.
BuildXml(XmlDocument, EbicsVersion)
Declaration
public override XmlElement BuildXml(XmlDocument xmlDocument, EbicsVersion nVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlDocument | xmlDocument | |
EbicsVersion | nVersion | The EBICS version for which to build the XML element. |
Returns
Type | Description |
---|---|
System.Xml.XmlElement |
Overrides
Remarks
This creates an XML element with the root node SignaturePubKeyInfo, AuthenticationPubKeyInfo, or EncryptionPubKeyInfo, depending on the current value of the Version property.
CheckCertificateSignature(EbicsPubKeyInfo)
Check the authority signature of the X509Certificate.
Declaration
public bool CheckCertificateSignature(EbicsPubKeyInfo aAuthPubKey)
Parameters
Type | Name | Description |
---|---|---|
EbicsPubKeyInfo | aAuthPubKey | The public key of the authority to check the certificate signature with.
For a self signed certificate this can be provided as |
Returns
Type | Description |
---|---|
System.Boolean | If the authority signature of the X509Certificate was
successfully verfified with the given public key, then |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
System.InvalidOperationException | The X509Certificate property was |
CreatePubKeyInfo(JsonObject)
Declaration
public static EbicsPubKeyInfo CreatePubKeyInfo(JsonObject jsonObject)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsonObject |
Returns
Type | Description |
---|---|
EbicsPubKeyInfo |
CreateSelfSignedCertificate(EbicsPrivKey, String)
Declaration
public void CreateSelfSignedCertificate(EbicsPrivKey aPrivKey, string sCommonName)
Parameters
Type | Name | Description |
---|---|---|
EbicsPrivKey | aPrivKey | A private key for signing the certificate. This key must match the public Modulus and Exponent of this instance. |
System.String | sCommonName | Preferably the caller should use the UserID as the common name of the certificate
subject. If this is |
Encrypt(Byte[])
Encrypt a symmetric transaction key with this RSA key.
Declaration
public byte[] Encrypt(byte[] vbInput)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | vbInput | The symmetric transaction key to be encrypted. |
Returns
Type | Description |
---|---|
System.Byte[] |
Remarks
This is a low level method that is not usually called by application code!
FromJson(JsonObject)
Initializes an EbicsPubKeyInfo-object from its json representation. FromJson(JsonObject).
Declaration
public void FromJson(JsonObject jsonObject)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsonObject |
GetFingerprint(Boolean)
Computes the fingerprint hash value for the printed Ini Letter. Starting with EBICS 3.0, this is different from GetPubKeyDigest().
Declaration
public byte[] GetFingerprint(bool fFromCertificate)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fFromCertificate | For EBICS 3.0 or French EBICS systems, this must be |
Returns
Type | Description |
---|---|
System.Byte[] |
See Also
GetPubKeyDigest()
Declaration
public EbicsDataBuffer GetPubKeyDigest()
Returns
Type | Description |
---|---|
EbicsDataBuffer |
ParseXml(XmlElement, EbicsVersion)
Declaration
public override void ParseXml(XmlElement xmlElement, EbicsVersion nVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlElement | xmlElement | |
EbicsVersion | nVersion |
Overrides
ToJson(JsonObject)
Converts an EbicsPubKeyInfo-object to its json representation. ToJson(JsonObject).
Declaration
public JsonObject ToJson(JsonObject jsonObject)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsonObject |
Returns
Type | Description |
---|---|
JsonObject |
ValidateKeys()
Checks whether the RSA keys lengths match the required key lengths according to the Version.
Declaration
public bool ValidateKeys()
Returns
Type | Description |
---|---|
System.Boolean | If an existing security version was chosen and both key parts are present and have
the correct length, then |
Verify(Byte[], Byte[])
Verify a signature with this key.
Declaration
public bool Verify(byte[] vbSignature, byte[] vbHash)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | vbSignature | The raw RSA signature value as a byte array in big endian order. |
System.Byte[] | vbHash | The raw computed hash value as a byte array. |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
This is a low level method that is not usually called by application code!