File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/main/java/com/microsoft/graph/core/models Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .microsoft .graph .core .models ;
2+
3+ import java .security .cert .CertificateEncodingException ;
4+ import java .security .cert .X509Certificate ;
5+ import java .util .Base64 ;
6+ import java .util .Objects ;
7+
8+ import jakarta .annotation .Nonnull ;
9+
10+ /**
11+ * EncryptableSubscription interface
12+ */
13+ public interface EncryptableSubscription {
14+
15+ /**
16+ * Sets the encryption certificate
17+ * @param certificate Base-64 encoded certificate to be used by Microsoft Graph to encrypt resource data
18+ */
19+ public void setEncryptionCertificate (String certificate );
20+
21+ /**
22+ * Returns the encryption certificate
23+ * @return encryption certificate
24+ */
25+ public String getEncryptionCertificate ();
26+
27+ /**
28+ * Converts an X.509 Certificate object to Base-64 string and adds to the encryptableSubscription provided
29+ * @param subscription encryptable subscription
30+ * @param certificate X.509 Certificate
31+ * @throws CertificateEncodingException
32+ */
33+ public static void addPublicEncryptionCertificate (@ Nonnull final EncryptableSubscription subscription , @ Nonnull final X509Certificate certificate ) throws CertificateEncodingException {
34+ Objects .requireNonNull (subscription );
35+ Objects .requireNonNull (certificate );
36+ subscription .setEncryptionCertificate (
37+ Base64 .getEncoder ().encodeToString (certificate .getEncoded ())
38+ );
39+ }
40+
41+ }
You can’t perform that action at this time.
0 commit comments