adding except to the X500 name string to allow = and , in the name

This commit is contained in:
Patrick Kuo 2017-05-12 10:45:59 +01:00
parent 550be76787
commit d69fd01b3e

View File

@ -109,6 +109,22 @@ class DBCertificateRequestStorageTest {
assertThat(storage.getResponse(requestId2)).isInstanceOf(CertificateResponse.Ready::class.java)
}
@Test
fun `request with equals symbol in legal name`() {
val requestId = storage.saveRequest(createRequest("Bank\\=A").first)
assertThat(storage.getPendingRequestIds()).isEmpty()
val response = storage.getResponse(requestId) as CertificateResponse.Unauthorised
assertThat(response.message).contains("=")
}
@Test
fun `request with comma in legal name`() {
val requestId = storage.saveRequest(createRequest("Bank\\,A").first)
assertThat(storage.getPendingRequestIds()).isEmpty()
val response = storage.getResponse(requestId) as CertificateResponse.Unauthorised
assertThat(response.message).contains(",")
}
private fun createRequest(legalName: String): Pair<CertificationRequestData, KeyPair> {
val keyPair = Crypto.generateKeyPair(DEFAULT_TLS_SIGNATURE_SCHEME)
val request = CertificationRequestData(