Class EbicsPrivKey
A private RSA user key.
public class EbicsPrivKey
- Inheritance
-
EbicsPrivKey
- Inherited Members
Constructors
EbicsPrivKey(EbicsSecurityCode, DateTime, CryRSA)
public EbicsPrivKey(EbicsSecurityCode nSecCode, DateTime tTimeStamp, CryRSA aRSA)
Parameters
nSecCodeEbicsSecurityCodeThe security process for which the key shall be used.
tTimeStampDateTimeThe exact time when the key was originally generated. Use DateTime.MinValue if not known or relevant.
aRSACryRSAThe RSA private key. Must not be
nulland must contain both, the public and private key parts.
Fields
MAXKEYLENGTH
Actually the maximum RSA key length allowed for any EBICS key is 16384 bits or 2048 bytes. This constant, however, places a more practical limit at 4096 bits, or 512 bytes.
public const int MAXKEYLENGTH = 512
Field Value
MINKEYLENGTH
The minimum RSA key length allowed for any EBICS key is 1024 bits or 128 bytes.
public const int MINKEYLENGTH = 128
Field Value
Properties
KeyLength
The actual length of the RSA modulus in bytes.
public int KeyLength { get; }
Property Value
RSA
public CryRSA RSA { get; }
Property Value
- CryRSA
SecurityCode
The security operation and implicit version that this key was generated for.
public EbicsSecurityCode SecurityCode { get; }
Property Value
TimeStamp
The time at which this key was initially generated.
public DateTime TimeStamp { get; }
Property Value
- DateTime
This is DateTime.MinValue if not known.
Methods
CopyPrivKeys(EbicsContact, IEbicsSecurityMedium, IEbicsSecurityMedium)
Copies all private keys from one security medium to another security medium.
public static void CopyPrivKeys(EbicsContact aContact, IEbicsSecurityMedium aSourceMedium, IEbicsSecurityMedium aDestMedium)
Parameters
aContactEbicsContactThe EBICS contact for which the keys shall be copied. A security medium may hold the keys for multiple contacts, hence this may be needed to identify the appropriate keys. Only the keys specified in AuthenticationVersion, EncryptionVersion, and SignatureVersion will be copied from the source to the destination medium.
aSourceMediumIEbicsSecurityMediumThe source security medium from which to copy the keys. This security medium must support getting the private keys, which is definitely not the case with smart cards. The security medium must already have been authenticated.
aDestMediumIEbicsSecurityMediumThe source security medium to which to copy the keys. This security medium must support setting the private keys, which is definitely not the case with smart cards. The security medium must already have been authenticated.
Exceptions
- ArgumentNullException
- NotSupportedException
Either the source or the destination security medium does not support access to the private keys. Or the destination medium does not support the key types from the source medium.
- InvalidOperationException
Either the source or the destination security medium was not in the Authenticated state.
Decrypt(byte[])
public byte[] Decrypt(byte[] vbCrypt)
Parameters
vbCryptbyte[]
Returns
- byte[]
Remarks
This is a low level method that is not usually called by application code!
DeletePrivKeys(EbicsContact, IEbicsSecurityMedium)
public static void DeletePrivKeys(EbicsContact aContact, IEbicsSecurityMedium aSecMedium)
Parameters
aContactEbicsContactaSecMediumIEbicsSecurityMedium
ExportKeyBlob()
Exports all key data in an opaque byte blob for storage.
public EbicsDataBuffer ExportKeyBlob()
Returns
- EbicsDataBuffer
Returns a data buffer with the key data. This key data can be used to re-create the private key via ImportKeyBlob(EbicsDataBuffer).
- See Also
Generate(EbicsSecurityCode, int)
Generates a new RSA key pair of the given length.
public static EbicsPrivKey Generate(EbicsSecurityCode nSecCode, int nKeyLength)
Parameters
nSecCodeEbicsSecurityCodeThe security operation for which the key shall be used.
nKeyLengthintByte length of the RSA keys to be generated. This must be in the range from MINKEYLENGTH to MAXKEYLENGTH.
Returns
Remarks
The public exponent is implicitly chosen as Fermat 4.
GetPublicExponent()
Provides the public RSA exponent (which is always Fermat 4) as a byte array.
public byte[] GetPublicExponent()
Returns
- byte[]
Returns a compact byte array that contains only the significant bytes of the public exponent.
Remarks
This is a low level method that is not usually called by application code!
GetPublicKeyInfo()
Provides the complete public key information.
public EbicsPubKeyInfo GetPublicKeyInfo()
Returns
- EbicsPubKeyInfo
A new EbicsPubKeyInfo instance that can be conveniently used to create a PubKeyInfo XML element and also to perform the public security operations.
GetPublicModulus()
Provides the common public RSA modulus as a byte array.
public byte[] GetPublicModulus()
Returns
- byte[]
Returns a compact byte array that contains only the significant bytes of the public modulus.
Remarks
This is a low level method that is not usually called by application code!
ImportKeyBlob(EbicsDataBuffer)
Creates a new EbicsPrivKey instance from a previously exported key blob.
public static EbicsPrivKey ImportKeyBlob(EbicsDataBuffer dKeyBlob)
Parameters
dKeyBlobEbicsDataBuffer
Returns
- See Also
SignHash(byte[])
public byte[] SignHash(byte[] vbHash)
Parameters
vbHashbyte[]
Returns
- byte[]
Remarks
This is a low level method that is not usually called by application code!