def pack(body, key)
      signed    = plaintext_signature(body, 'application/atom+xml', 'base64url', 'RSA-SHA256')
      signature = Base64.urlsafe_encode64(key.sign(digest, signed))

      Nokogiri::XML::Builder.new do |xml|
        xml['me'].env({ 'xmlns:me' => XMLNS }) do
          xml['me'].data({ type: 'application/atom+xml' }, Base64.urlsafe_encode64(body))
          xml['me'].encoding('base64url')
          xml['me'].alg('RSA-SHA256')
          xml['me'].sig({ key_id: Base64.urlsafe_encode64(key.public_key.to_s) }, signature)
        end
      end.to_xml
    end
def pack(body, key)
      signed    = plaintext_signature(body, 'application/atom+xml', 'base64url', 'RSA-SHA256')
      signature = Base64.urlsafe_encode64(key.sign(digest, signed))

      Nokogiri::XML::Builder.new do |xml|
        xml['me'].env({ 'xmlns:me' => XMLNS }) do
          xml['me'].data({ type: 'application/atom+xml' }, Base64.urlsafe_encode64(body))
          xml['me'].encoding('base64url')
          xml['me'].alg('RSA-SHA256')
          xml['me'].sig({ key_id: Base64.urlsafe_encode64(key.public_key.to_s) }, signature)
        end
      end.to_xml
    end
Create a magical envelope XML document around the original body
 and sign it with a private key
 @param [String] body
 @param [OpenSSL::PKey::RSA] key The private part of the key will be used
 @return [String] Magical envelope XML