Skip to content

Commit

Permalink
Fixes javadocs. Applies manual formatting for the sake of readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
lyubomir committed Mar 14, 2016
1 parent a806961 commit 023f50a
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/org/jitsi/impl/neomedia/transform/dtls/DtlsControlImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ public class DtlsControlImpl
= DtlsControlImpl.class.getName() + ".verifyAndValidateCertificate";

/**
* A private and public keys cached for 24h
* A private and public keys cached for 24 hours.
*/
private static AsymmetricCipherKeyPair _keyPairCache;

/**
* _keyPairCache generation timestamp
* {@link #_keyPairCache} generation timestamp (in milliseconds of system
* time).
*/
private static long _keyPairCacheTimestamp;

Expand Down Expand Up @@ -383,28 +384,28 @@ private static X500Name generateCN()
}

/**
* Return a pair of RSA private and public keys.
* We cache it for 24H
* Return a pair of RSA private and public keys. We cache it for 24 hours.
*
* @return a pair of private and public keys
*/
private static AsymmetricCipherKeyPair generateKeyPair()
private static synchronized AsymmetricCipherKeyPair generateKeyPair()
{
synchronized (DtlsControlImpl.class)
if (_keyPairCache == null
|| _keyPairCacheTimestamp + ONE_DAY
< System.currentTimeMillis())
{
if (_keyPairCache == null || _keyPairCacheTimestamp
+ ONE_DAY < System.currentTimeMillis())
{
RSAKeyPairGenerator generator = new RSAKeyPairGenerator();

generator.init(
new RSAKeyGenerationParameters(new BigInteger("10001", 16),
createSecureRandom(), 1024, 80));
_keyPairCache = generator.generateKeyPair();
_keyPairCacheTimestamp = System.currentTimeMillis();
}
return _keyPairCache;
RSAKeyPairGenerator generator = new RSAKeyPairGenerator();

generator.init(
new RSAKeyGenerationParameters(
new BigInteger("10001", 16),
createSecureRandom(),
1024,
80));
_keyPairCache = generator.generateKeyPair();
_keyPairCacheTimestamp = System.currentTimeMillis();
}
return _keyPairCache;
}

/**
Expand Down

0 comments on commit 023f50a

Please sign in to comment.