Source:
<code>private static boolean checkSecurityTokenCompatibility(PGPSecretKey key, OperationLog log, int indent) { final PGPPublicKey publicKey = key.getPublicKey(); ASN1ObjectIdentifier curve; switch (publicKey.getAlgorithm()) { case PublicKeyAlgorithmTags.RSA_ENCRYPT: case PublicKeyAlgorithmTags.RSA_SIGN: case PublicKeyAlgorithmTags.RSA_GENERAL: if (publicKey.getBitStrength() < 2048) { <START> log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_SIZE, indent + 1); <END> return false; } break; case PublicKeyAlgorithmTags.ECDH: curve = ((ECDHPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDSA: curve = ((ECDSAPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; default: log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_ALGO, indent + 1); return false; } if (isDivertToCard(key) || isDummy(key)) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_STRIPPED, indent + 1); return false; } return true; }</code><technical_language>This is longer log entry. if statement limited allowed RSA keys 2048 bit security tokens this limit. check RSA bit sizes ECC curves supported attached token in SecurityTokenHelper.putKey? Another possibility: Is error returned security token displayed user in this case</technical_language>

Target:
private static boolean checkSecurityTokenCompatibility(PGPSecretKey key, OperationLog log, int indent) { final PGPPublicKey publicKey = key.getPublicKey(); ASN1ObjectIdentifier curve; switch (publicKey.getAlgorithm()) { case PublicKeyAlgorithmTags.RSA_ENCRYPT: case PublicKeyAlgorithmTags.RSA_SIGN: case PublicKeyAlgorithmTags.RSA_GENERAL: if (publicKey.getBitStrength() < 2048) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_RSA_KEY_SIZE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDH: curve = ((ECDHPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; case PublicKeyAlgorithmTags.ECDSA: curve = ((ECDSAPublicBCPGKey)(publicKey.getPublicKeyPacket().getKey())).getCurveOID(); if (!curve.equals(NISTNamedCurves.getOID("P-256")) && !curve.equals(NISTNamedCurves.getOID("P-384")) && !curve.equals(NISTNamedCurves.getOID("P-521"))) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_CURVE, indent + 1); return false; } break; default: log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_ALGO, indent + 1); return false; } if (isDivertToCard(key) || isDummy(key)) { log.add(LogType.MSG_MF_ERROR_BAD_SECURITY_TOKEN_STRIPPED, indent + 1); return false; } return true; }