de.flexiprovider.pqc.rainbow
Class RainbowKeyFactory
java.lang.Object
|
+--java.security.KeyFactorySpi
|
+--de.flexiprovider.api.keys.KeyFactory
|
+--de.flexiprovider.pqc.rainbow.RainbowKeyFactory
- public class RainbowKeyFactory
- extends KeyFactory
This class transforms Rainbow keys and Rainbow key specifications into a form
that can be used with the FlexiPQCProvider.
- Author:
- Patrick Neugebauer, Marius Senftleben, Tsvetoslava Vateva
- See Also:
RainbowPublicKey,
RainbowPublicKeySpec,
RainbowPrivateKey,
de.flexiprovider.pqc.rainbow.RainbowPrivatekeySpec
|
Field Summary |
static java.lang.String |
OID
The OID of Rainbow |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OID
public static final java.lang.String OID
- The OID of Rainbow
RainbowKeyFactory
public RainbowKeyFactory()
generatePrivate
public PrivateKey generatePrivate(KeySpec keySpec)
throws InvalidKeySpecException
- Converts, if possible, a key specification into a
RainbowPrivateKey. Currently, the following key specifications
are supported: RainbowParameterSpec, PKCS8EncodedKeySpec.
The ASN.1 definition of the key structure is
RainbowPrivateKey ::= SEQUENCE {
oid OBJECT IDENTIFIER -- OID identifying the algorithm
A1inv SEQUENCE OF OCTET STRING -- inversed matrix of L1
b1 OCTET STRING -- translation vector of L1
A2inv SEQUENCE OF OCTET STRING -- inversed matrix of L2
b2 OCTET STRING -- translation vector of L2
vi OCTET STRING -- num of elmts in each Set S
layers SEQUENCE OF Layer -- layers of F
}
Layer ::= SEQUENCE OF Poly
Poly ::= SEQUENCE {
alpha SEQUENCE OF OCTET STRING
beta SEQUENCE OF OCTET STRING
gamma OCTET STRING
eta OCTET
}
- Overrides:
generatePrivate in class KeyFactory
- Parameters:
keySpec - the key specification- Returns:
- the key data to encode in the SubjectPublicKeyInfo structure
- Throws:
InvalidKeySpecException - if the KeySpec is not supported.
generatePublic
public PublicKey generatePublic(KeySpec keySpec)
throws InvalidKeySpecException
- Converts, if possible, a key specification into a
RainbowPublicKey. Currently, the following key specifications are
supported: RainbowParameterSpec, X509EncodedKeySpec.
The ASN.1 definition of a public key's structure is
RainbowPublicKey ::= SEQUENCE {
oid OBJECT IDENTIFIER -- OID identifying the algorithm
docLength Integer -- length of signable msg
coeffquadratic SEQUENCE OF OCTET STRING -- quadratic (mixed) coefficients
coeffsingular SEQUENCE OF OCTET STRING -- singular coefficients
coeffscalar OCTET STRING -- scalar coefficients
}
- Overrides:
generatePublic in class KeyFactory
- Parameters:
keySpec - the key specification- Returns:
- the key data to encode in the SubjectPublicKeyInfo structure
- Throws:
InvalidKeySpecException - if the KeySpec is not supported.
getKeySpec
public final KeySpec getKeySpec(Key key,
java.lang.Class keySpec)
throws InvalidKeySpecException
- Converts a given key into a key specification, if possible. Currently the
following specs are supported:
- for RainbowPublicKey: X509EncodedKeySpec, RainbowPublicKeySpec
- for RainbowPrivateKey: PKCS8EncodedKeySpec, RainbowPrivateKeySpec
- Overrides:
getKeySpec in class KeyFactory
- Parameters:
key - the keykeySpec - the key specification- Returns:
- the specification of the CMSS key
- Throws:
InvalidKeySpecException - if the key type or key specification is not supported.- See Also:
RainbowPrivateKey,
RainbowPrivateKeySpec,
RainbowPublicKey,
RainbowPublicKeySpec
translateKey
public final Key translateKey(Key key)
throws InvalidKeyException
- Translates a key into a form known by the FlexiProvider. Currently the
following key types are supported: RainbowPrivateKey, RainbowPublicKey.
- Overrides:
translateKey in class KeyFactory
- Parameters:
key - the key- Returns:
- a key of a known key type
- Throws:
InvalidKeyException - if the key is not supported.