Bouncy Castle Cryptography Library 1.87

org.bouncycastle.crypto.constraints
Class QuantumVulnerableConstraint

java.lang.Object
  extended byorg.bouncycastle.crypto.constraints.ServicesConstraint
      extended byorg.bouncycastle.crypto.constraints.QuantumVulnerableConstraint
All Implemented Interfaces:
CryptoServicesConstraints

public class QuantumVulnerableConstraint
extends ServicesConstraint

A constraint on the quantum-vulnerable public-key algorithms (RSA, DSA, DH, EC and the Edwards/Montgomery curve schemes, and the KEMs and key agreements built on them) following the transition timetable of NIST IR 8547: a quantum-vulnerable service is allowed until the deprecation date, allowed but logged between the deprecation date and the disallow date, and refused after the disallow date except for "legacy use" - verification and decryption of data protected earlier, which SP 800-131A continues to permit.

The no-argument constructor applies the NIST dates: deprecated after 2030, disallowed after 2035. Any other policy is expressed by passing the dates explicitly; a date in the past deprecates or disallows the algorithms immediately, a date far in the future turns that step off. Services named in the exceptions set are not checked at all.

Three fixed policies are available without dates: logOnly() logs every use of a quantum-vulnerable service and refuses nothing, legacyUseOnly() refuses new protection (key generation, signing, encryption and key agreement) while allowing verification and decryption, and rejectAll() refuses every use, legacy use included. One of them, or the NIST timetable, can also be installed as the default constraint through the Properties.CONSTRAINTS_QUANTUM_VULNERABLE property; see forPolicy(String).

Which services count as quantum-vulnerable is decided by ConstraintUtils.isQuantumVulnerable(CryptoServiceProperties); the post-quantum algorithms (ML-KEM, ML-DSA, SLH-DSA, LMS/HSS, XMSS and the candidates) are never affected. Note that a service reporting the purpose CryptoServicePurpose.ANY cannot be told from a legacy use and is treated as one where legacy use is allowed.


Field Summary
static java.util.Date NIST_DEPRECATED_AFTER
          1 January 2031, 00:00 UTC: NIST IR 8547 deprecates the quantum-vulnerable public-key algorithms after 2030.
static java.util.Date NIST_DISALLOWED_AFTER
          1 January 2036, 00:00 UTC: NIST IR 8547 disallows the quantum-vulnerable public-key algorithms after 2035.
static java.lang.String POLICY_LEGACY
          The policy name selecting legacyUseOnly().
static java.lang.String POLICY_LOG
          The policy name selecting logOnly().
static java.lang.String POLICY_NIST
          The policy name selecting the NIST IR 8547 timetable, QuantumVulnerableConstraint().
static java.lang.String POLICY_NONE
          The policy name selecting no constraint at all.
static java.lang.String POLICY_REJECT
          The policy name selecting rejectAll().
 
Fields inherited from class org.bouncycastle.crypto.constraints.ServicesConstraint
LOG
 
Constructor Summary
QuantumVulnerableConstraint()
          Apply the NIST IR 8547 timetable: deprecated after 2030, disallowed after 2035.
QuantumVulnerableConstraint(java.util.Date deprecatedAfter, java.util.Date disallowedAfter)
          Apply an explicit timetable.
QuantumVulnerableConstraint(java.util.Date deprecatedAfter, java.util.Date disallowedAfter, boolean allowLegacyUse, java.util.Set exceptions)
          Apply an explicit timetable, choosing whether legacy use survives the disallow date.
QuantumVulnerableConstraint(java.util.Date deprecatedAfter, java.util.Date disallowedAfter, java.util.Set exceptions)
          Apply an explicit timetable with a set of service names that are not checked.
QuantumVulnerableConstraint(java.util.Set exceptions)
          Apply the NIST IR 8547 timetable with a set of service names that are not checked.
 
Method Summary
 void check(CryptoServiceProperties service)
           
static QuantumVulnerableConstraint forPolicy(java.lang.String policy)
          Return the constraint a policy name selects: POLICY_NIST for the NIST IR 8547 timetable, POLICY_LOG for logOnly(), POLICY_LEGACY for legacyUseOnly(), POLICY_REJECT for rejectAll() and POLICY_NONE for no constraint.
static QuantumVulnerableConstraint legacyUseOnly()
          Return a constraint that refuses a quantum-vulnerable service for key generation, signing, encryption and key agreement, and allows it, logged, for verification and decryption - the SP 800-131A "legacy use".
static QuantumVulnerableConstraint legacyUseOnly(java.util.Set exceptions)
          Return a constraint that refuses a quantum-vulnerable service for key generation, signing, encryption and key agreement, and allows it, logged, for verification and decryption - the SP 800-131A "legacy use".
static QuantumVulnerableConstraint logOnly()
          Return a constraint that logs every use of a quantum-vulnerable service, at level INFO, and refuses nothing.
static QuantumVulnerableConstraint logOnly(java.util.Set exceptions)
          Return a constraint that logs every use of a quantum-vulnerable service, at level INFO, and refuses nothing.
static QuantumVulnerableConstraint rejectAll()
          Return a constraint that refuses every use of a quantum-vulnerable service, verification and decryption included.
static QuantumVulnerableConstraint rejectAll(java.util.Set exceptions)
          Return a constraint that refuses every use of a quantum-vulnerable service, verification and decryption included.
 
Methods inherited from class org.bouncycastle.crypto.constraints.ServicesConstraint
isException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NIST_DEPRECATED_AFTER

public static final java.util.Date NIST_DEPRECATED_AFTER
1 January 2031, 00:00 UTC: NIST IR 8547 deprecates the quantum-vulnerable public-key algorithms after 2030.


NIST_DISALLOWED_AFTER

public static final java.util.Date NIST_DISALLOWED_AFTER
1 January 2036, 00:00 UTC: NIST IR 8547 disallows the quantum-vulnerable public-key algorithms after 2035.


POLICY_NIST

public static final java.lang.String POLICY_NIST
The policy name selecting the NIST IR 8547 timetable, QuantumVulnerableConstraint().

See Also:
Constant Field Values

POLICY_LOG

public static final java.lang.String POLICY_LOG
The policy name selecting logOnly().

See Also:
Constant Field Values

POLICY_LEGACY

public static final java.lang.String POLICY_LEGACY
The policy name selecting legacyUseOnly().

See Also:
Constant Field Values

POLICY_REJECT

public static final java.lang.String POLICY_REJECT
The policy name selecting rejectAll().

See Also:
Constant Field Values

POLICY_NONE

public static final java.lang.String POLICY_NONE
The policy name selecting no constraint at all.

See Also:
Constant Field Values
Constructor Detail

QuantumVulnerableConstraint

public QuantumVulnerableConstraint()
Apply the NIST IR 8547 timetable: deprecated after 2030, disallowed after 2035.


QuantumVulnerableConstraint

public QuantumVulnerableConstraint(java.util.Set exceptions)
Apply the NIST IR 8547 timetable with a set of service names that are not checked.

Parameters:
exceptions - set of service names which are exceptions to the rules.

QuantumVulnerableConstraint

public QuantumVulnerableConstraint(java.util.Date deprecatedAfter,
                                   java.util.Date disallowedAfter)
Apply an explicit timetable.

Parameters:
deprecatedAfter - the instant from which use of a quantum-vulnerable service is logged.
disallowedAfter - the instant from which a quantum-vulnerable service is refused for anything other than legacy use.

QuantumVulnerableConstraint

public QuantumVulnerableConstraint(java.util.Date deprecatedAfter,
                                   java.util.Date disallowedAfter,
                                   java.util.Set exceptions)
Apply an explicit timetable with a set of service names that are not checked.

Parameters:
deprecatedAfter - the instant from which use of a quantum-vulnerable service is logged.
disallowedAfter - the instant from which a quantum-vulnerable service is refused for anything other than legacy use.
exceptions - set of service names which are exceptions to the rules.

QuantumVulnerableConstraint

public QuantumVulnerableConstraint(java.util.Date deprecatedAfter,
                                   java.util.Date disallowedAfter,
                                   boolean allowLegacyUse,
                                   java.util.Set exceptions)
Apply an explicit timetable, choosing whether legacy use survives the disallow date.

Parameters:
deprecatedAfter - the instant from which use of a quantum-vulnerable service is logged.
disallowedAfter - the instant from which a quantum-vulnerable service is refused.
allowLegacyUse - true if verification and decryption are still allowed after the disallow date, false if they are refused along with everything else.
exceptions - set of service names which are exceptions to the rules.
Method Detail

logOnly

public static QuantumVulnerableConstraint logOnly()
Return a constraint that logs every use of a quantum-vulnerable service, at level INFO, and refuses nothing.

Returns:
a log-only constraint.

logOnly

public static QuantumVulnerableConstraint logOnly(java.util.Set exceptions)
Return a constraint that logs every use of a quantum-vulnerable service, at level INFO, and refuses nothing.

Parameters:
exceptions - set of service names which are not logged.
Returns:
a log-only constraint.

legacyUseOnly

public static QuantumVulnerableConstraint legacyUseOnly()
Return a constraint that refuses a quantum-vulnerable service for key generation, signing, encryption and key agreement, and allows it, logged, for verification and decryption - the SP 800-131A "legacy use".

Returns:
a legacy-use-only constraint.

legacyUseOnly

public static QuantumVulnerableConstraint legacyUseOnly(java.util.Set exceptions)
Return a constraint that refuses a quantum-vulnerable service for key generation, signing, encryption and key agreement, and allows it, logged, for verification and decryption - the SP 800-131A "legacy use".

Parameters:
exceptions - set of service names which are not checked.
Returns:
a legacy-use-only constraint.

rejectAll

public static QuantumVulnerableConstraint rejectAll()
Return a constraint that refuses every use of a quantum-vulnerable service, verification and decryption included.

Returns:
a reject-all constraint.

rejectAll

public static QuantumVulnerableConstraint rejectAll(java.util.Set exceptions)
Return a constraint that refuses every use of a quantum-vulnerable service, verification and decryption included.

Parameters:
exceptions - set of service names which are not checked.
Returns:
a reject-all constraint.

forPolicy

public static QuantumVulnerableConstraint forPolicy(java.lang.String policy)
Return the constraint a policy name selects: POLICY_NIST for the NIST IR 8547 timetable, POLICY_LOG for logOnly(), POLICY_LEGACY for legacyUseOnly(), POLICY_REJECT for rejectAll() and POLICY_NONE for no constraint. The names are case-insensitive and surrounding white space is ignored. This is how the value of the Properties.CONSTRAINTS_QUANTUM_VULNERABLE property is read.

Parameters:
policy - the policy name.
Returns:
the constraint, or null for POLICY_NONE.
Throws:
java.lang.IllegalArgumentException - if the name is not one of the above.

check

public void check(CryptoServiceProperties service)

Bouncy Castle Cryptography Library 1.87