use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.
the class RSASignerTestCase method testAsciiMessageSigning.
/**
* Tests that a valid ASCII-based message is correctly signed.
*/
@Test
public void testAsciiMessageSigning() {
signer = new RSASigner(privateKeyFixture);
ChatMessage message = messageFixtures.get(0);
assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.
the class RSASignerTestCase method testUnicodeMessageSigning.
/**
* Tests that a unicode (european) message is correctly signed.
*/
@Test
public void testUnicodeMessageSigning() {
signer = new RSASigner(privateKeyFixture);
ChatMessage message = messageFixtures.get(1);
assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.
the class RSASignerTestCase method testPrivateKeyNull.
/**
* Tests that when the private key associated with
* the signer is null, the signer returns null.
*/
@Test
public void testPrivateKeyNull() {
signer = new RSASigner(null);
ChatMessage message = messageFixtures.get(0);
assertThat(signer.sign(message.getText())).isNull();
}
use of de.tum.in.tumcampusapp.utils.RSASigner in project TumCampusApp by TCA-Team.
the class RSASignerTestCase method testUnicodeKoreanMessageSigning.
/**
* Tests that a unicode (korean) message is correctly signed.
*/
@Test
public void testUnicodeKoreanMessageSigning() {
signer = new RSASigner(privateKeyFixture);
ChatMessage message = messageFixtures.get(2);
assertThat(signer.sign(message.getText())).isEqualTo(message.getSignature());
}
Aggregations