public static void populateSigAlgs(KeyPairType keyPairType,PrivateKey privateKey,Provider provider,JComboBox<SignatureType> jcbSignatureAlgorithm) throws CryptoException {
  List<SignatureType> sigAlgs;
switch (keyPairType) {
case RSA:
    KeyInfo keyInfo=KeyPairUtil.getKeyInfo(privateKey);
  sigAlgs=SignatureType.rsaSignatureTypes(keyInfo.getSize());
break;
case DSA:
sigAlgs=SignatureType.dsaSignatureTypes();
break;
case EC:
default :
sigAlgs=SignatureType.ecdsaSignatureTypes();
}
jcbSignatureAlgorithm.removeAllItems();
for (SignatureType sigAlg : sigAlgs) {
jcbSignatureAlgorithm.addItem(sigAlg);
}
if (sigAlgs.contains(SignatureType.SHA256_RSA)) {
jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_RSA);
}
 else if (sigAlgs.contains(SignatureType.SHA256_ECDSA)) {
jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_ECDSA);
}
 else if (sigAlgs.contains(SignatureType.SHA256_DSA)) {
jcbSignatureAlgorithm.setSelectedItem(SignatureType.SHA256_DSA);
}
 else {
jcbSignatureAlgorithm.setSelectedIndex(0);
}
}

public static void populateSigAlgs ( KeyPairType keyPairType , PrivateKey privateKey , Provider provider , JComboBox < SignatureType > jcbSignatureAlgorithm ) throws CryptoException { List < SignatureType > sigAlgs ; switch ( keyPairType ) { case RSA : KeyInfo keyInfo = KeyPairUtil . getKeyInfo ( privateKey ) ; sigAlgs = SignatureType . rsaSignatureTypes ( keyInfo . getSize ( ) ) ; break ; case DSA : sigAlgs = SignatureType . dsaSignatureTypes ( ) ; break ; case EC : default : sigAlgs = SignatureType . ecdsaSignatureTypes ( ) ; } jcbSignatureAlgorithm . removeAllItems ( ) ; for ( SignatureType sigAlg : sigAlgs ) { jcbSignatureAlgorithm . addItem ( sigAlg ) ; } if ( sigAlgs . contains ( SignatureType . SHA256_RSA ) ) { jcbSignatureAlgorithm . setSelectedItem ( SignatureType . SHA256_RSA ) ; } else if ( sigAlgs . contains ( SignatureType . SHA256_ECDSA ) ) { jcbSignatureAlgorithm . setSelectedItem ( SignatureType . SHA256_ECDSA ) ; } else if ( sigAlgs . contains ( SignatureType . SHA256_DSA ) ) { jcbSignatureAlgorithm . setSelectedItem ( SignatureType . SHA256_DSA ) ; } else { jcbSignatureAlgorithm . setSelectedIndex ( 0 ) ; } }
populate a jcombobox with signature algorithms depending on the key pair type .
