Commit 77ce12b0 authored by Larbi Gharib's avatar Larbi Gharib
Browse files

user: add UID field in certificate

Change-Id: Ie439b15504c30fed8b650f89eca47436ad297956
parent 8da75196
......@@ -11,6 +11,11 @@
<artifactId>cryptoengine</artifactId>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons.codec.version}</version>
</dependency>
<dependency>
<groupId>net.jami</groupId>
<artifactId>jams-common</artifactId>
......
......@@ -54,6 +54,9 @@ public class UserBuilder {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(4096);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
user.getX509Fields().setUid(Hex.encodeHexString(MessageDigest.getInstance(MessageDigestAlgorithms.SHA_1).digest(keyPair.getPublic().getEncoded())));
X509v3CertificateBuilder builder = new X509v3CertificateBuilder(
new JcaX509CertificateHolder(JamsCA.CA.getCertificate()).getSubject(),
new BigInteger(128, new SecureRandom()),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment