Class HttpMessageSecurity
- java.lang.Object
-
- com.microsoft.azure.keyvault.messagesecurity.HttpMessageSecurity
-
public class HttpMessageSecurity extends Object
Implements message security protocol. Encrypts requests & decrypts responses.
-
-
Constructor Summary
Constructors Constructor Description HttpMessageSecurity(String clientSecurityToken, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString)Constructor.HttpMessageSecurity(String clientSecurityToken, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString, JsonWebKey clientEncryptionKey)Constructor.HttpMessageSecurity(String clientSecurityToken, String clientEncryptionString, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString, boolean testMode)Constructor (tests only).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.RequestprotectRequest(okhttp3.Request request)Protects existing request.okhttp3.ResponseunprotectResponse(okhttp3.Response response)Unprotects response if needed.
-
-
-
Constructor Detail
-
HttpMessageSecurity
public HttpMessageSecurity(String clientSecurityToken, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString) throws IOException
Constructor.- Parameters:
clientSecurityToken- pop or bearer authentication token.clientSignatureKeyString- string with client signing key (public + private parts) or null if not supportedserverEncryptionKeyString- string with server encryption key (public only) or null if not supportedserverSignatureKeyString- string with server signing key (public only) or null if not supported- Throws:
IOException- throws IOException
-
HttpMessageSecurity
public HttpMessageSecurity(String clientSecurityToken, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString, JsonWebKey clientEncryptionKey) throws IOException
Constructor.- Parameters:
clientSecurityToken- pop or bearer authentication token.clientSignatureKeyString- string with client signing key (public + private parts) or null if not supportedserverEncryptionKeyString- string with server encryption key (public only) or null if not supportedserverSignatureKeyString- string with server signing key (public only) or null if not supportedclientEncryptionKey- client encryption key (public + private parts) or null if not supported- Throws:
IOException- throws IOException
-
HttpMessageSecurity
public HttpMessageSecurity(String clientSecurityToken, String clientEncryptionString, String clientSignatureKeyString, String serverEncryptionKeyString, String serverSignatureKeyString, boolean testMode) throws IOException
Constructor (tests only).- Parameters:
clientSecurityToken- pop or bearer authentication token.clientEncryptionString- string with client signing key (public + private parts) or null if not supportedclientSignatureKeyString- string with client signing key (public + private parts) or null if not supportedserverEncryptionKeyString- string with server encryption key (public only) or null if not supportedserverSignatureKeyString- string with server signing key (public only) or null if not supportedtestMode- true for test mode (uses 0 for timestamp)- Throws:
IOException- throws IOException
-
-
Method Detail
-
protectRequest
public okhttp3.Request protectRequest(okhttp3.Request request) throws IOExceptionProtects existing request. Replaces its body with encrypted version.- Parameters:
request- existing request.- Returns:
- new request with encrypted body if supported or existing request.
- Throws:
IOException- throws IOException
-
unprotectResponse
public okhttp3.Response unprotectResponse(okhttp3.Response response) throws IOExceptionUnprotects response if needed. Replaces its body with unencrypted version.- Parameters:
response- server response.- Returns:
- new response with unencrypted body if supported or existing response.
- Throws:
IOException- throws IOException
-
-