// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.tls;

import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;

/**
 * @author bjorncs
 */
public class KeyUtils {
    private KeyUtils() {}

    public static KeyPair generateKeypair(KeyAlgorithm algorithm, int keySize) {
        try {
            KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithm.getAlgorithmName());
            keyGen.initialize(keySize);
            return keyGen.genKeyPair();
        } catch (GeneralSecurityException e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -537,16 +537,53 @@
 ame());%0A
+            if (keySize != -1) %7B%0A    
         
@@ -610,24 +610,38 @@
 e(keySize);%0A
+            %7D%0A
             
@@ -754,24 +754,24 @@
 ception(e);%0A
-
         %7D%0A  
@@ -773,11 +773,133 @@
  %7D%0A    %7D
+%0A%0A    public static KeyPair generateKeypair(KeyAlgorithm algorithm) %7B%0A        return generateKeypair(algorithm, -1);%0A    %7D
 %0A%7D%0A

Add method for creating keypair with default size