Interface DecryptableContent


public interface DecryptableContent
DecryptableContent interface
  • Method Details

    • setData

      void setData(@Nullable String data)
      Sets the data
      Parameters:
      data - resource data
    • getData

      @Nullable String getData()
      Gets the data
      Returns:
      the data
    • setDataKey

      void setDataKey(@Nullable String dataKey)
      Sets the data key
      Parameters:
      dataKey - asymmetric key used to sign data
    • getDataKey

      @Nullable String getDataKey()
      Gets the data key
      Returns:
      the data key
    • setDataSignature

      void setDataSignature(@Nullable String signature)
      Sets the data signature
      Parameters:
      signature - signature of the data
    • getDataSignature

      @Nullable String getDataSignature()
      Gets the data signature
      Returns:
      data signature
    • setEncryptionCertificateId

      void setEncryptionCertificateId(@Nullable String encryptionCertificateId)
      Sets the encryption certificate id
      Parameters:
      encryptionCertificateId - certificate Id used when subscribing
    • getEncryptionCertificateId

      @Nullable String getEncryptionCertificateId()
      Gets the encryption certificate id
      Returns:
      the encryption certificate id
    • setEncryptionCertificateThumbprint

      void setEncryptionCertificateThumbprint(@Nullable String encryptionCertificateThumbprint)
      Sets the encryption certificate thumbprint
      Parameters:
      encryptionCertificateThumbprint - certificate thumbprint
    • getEncryptionCertificateThumbprint

      @Nullable String getEncryptionCertificateThumbprint()
      Gets the encryption certificate thumbprint
      Returns:
      the encryption certificate thumbprint
    • decrypt

      @Nonnull static <T extends com.microsoft.kiota.serialization.Parsable> T decrypt(@Nonnull DecryptableContent decryptableContent, @Nonnull DecryptableContent.CertificateKeyProvider certificateKeyProvider, @Nonnull com.microsoft.kiota.serialization.ParsableFactory<T> factory) throws Exception
      Validates the signature of the resource data, decrypts resource data and deserializes the data to a Parsable https://learn.microsoft.com/en-us/graph/change-notifications-with-resource-data?tabs=csharp#decrypting-resource-data-from-change-notifications
      Type Parameters:
      T - Parsable type to return
      Parameters:
      decryptableContent - instance of DecryptableContent
      certificateKeyProvider - provides an RSA Private Key for the certificate provided when subscribing
      factory - ParsableFactory for the return type
      Returns:
      decrypted resource data
      Throws:
      Exception - if an error occurs while decrypting the data
    • decryptAsString

      @Nonnull static String decryptAsString(@Nonnull DecryptableContent content, @Nonnull DecryptableContent.CertificateKeyProvider certificateKeyProvider) throws Exception
      Validates the signature and decrypts resource data attached to the notification. https://learn.microsoft.com/en-us/graph/change-notifications-with-resource-data?tabs=csharp#decrypting-resource-data-from-change-notifications
      Parameters:
      content - instance of DecryptableContent
      certificateKeyProvider - provides an RSA Private Key for the certificate provided when subscribing
      Returns:
      decrypted resource data
      Throws:
      Exception - if an error occurs while decrypting the data
    • aesDecrypt

      @Nonnull static byte[] aesDecrypt(@Nonnull byte[] data, @Nonnull byte[] key) throws Exception
      Decrypts the resource data using the decrypted symmetric key
      Parameters:
      data - Base-64 decoded resource data
      key - Decrypted symmetric key from DecryptableContent.getDataKey()
      Returns:
      decrypted resource data
      Throws:
      Exception - if an error occurs while decrypting the data