SP metadata: certificate for signing and encryption
cryptography, saml-2.0, service-provider, shibboleth
Solution
Metadata of your own service should contain your public key with the certificate. And yes, you can use the same one for both signing and encryption.
When IDP wants to encrypt data to be sent to SP, it does so using public key of the SP. So there's no need to include "certificate of the open key of IdP" as an encryption key.
You mention that using the same key for both signing and encryption doesn't work, have you been able to get more details on what exactly fails and where?
Problem
The specification says that: Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0 2.4.1.1 Element `<KeyDescriptor>` The `<KeyDescriptor>` element provides information about the cryptographic key(s) that an entity uses to sign data or receive encrypted keys, along with additional cryptographic details. Its `KeyDescriptorType` complex type consists of the following elements and attributes: `use`[Optional] Optional attribute specifying the purpose of the key being described. Values are drawn from the KeyTypes enumeration, and consist of the values `encryption` and `signing`. `<ds:KeyInfo>`[Required] Optional element that directly or indirectly identifies a key. As far as I know, for the sending of secure data in both directions, I should have: - My own private key - My own public key - Recipient's public key Certificate of what key I should specifying in the SP- metadata and сan I use the same certificate for signing and encryption? Vendor of IdP provided the so-called "metadata template" where indicated what and where should be spelled out. Here is relevant part (verbatim): ``` ... <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> <!-- TODO It is necessary to insert here the certificate of the signature key of the service provider in X509 DER format and Base64 encoded --> </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:KeyDescriptor use="encryption"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> <!-- TODO It is necessary to insert here the certificate of the signature key of the service provider in X509 DER format and Base64 encoded --> </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> ... ``` I do so: ``` ... <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> MIID...ZiQ== </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:KeyDescriptor use="encryption"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> MIID...ZiQ== </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> ... ``` It does not work. So, AFAIK for signing I should use the certificate of my private key, and for encryption I should use the certificate of the open key of IdP. IMHO should be so. ``` ... <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> <!-- certificate of my private key here--> </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:KeyDescriptor use="encryption"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate> <!-- certificate of the open key of IdP here --> </ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> ... ``` Am I right?