The only asymetrical encryption algorithm supported by Xceed Encryption Library is RSA-OAEP which is part of the latest PKCS#1 document. If you have in your possession a RSA private or a public key that have not been created by Xceed Encryption Library it may or may not be compatible with the library, depending if it conforms to the OAEP standard or not.
A good way to know if the key is compatible is to try it! Assign the PrivateKey property or the PublicKey property to a XceedRSAEncryptionMethod object and try to, respectively, Decrypt or Encrypt a bunch of data. If the key is invalid you will have a eerInvalidKeyPair (0x8004500E) error code.
A more user-friendly way to guess if a key is OAEP is by checking the first byte of either the Private or Public key. If it’s ASCII 30 (in hexadecimal) there’s a chance that the key will be accepted by Xceed Encryption Library. This is due to the DER encoding that we are using. If it’s not “30” then you can be sure that the key is not according to the OAEP format and will be rejected.
Imported from legacy forums. Posted by Xceed admin (had 781 views)