de.flexiprovider.pqc.pflash
Class PFlashSignature

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--de.flexiprovider.api.Signature
              |
              +--de.flexiprovider.pqc.pflash.PFlashSignature

public class PFlashSignature
extends Signature

This class implements the pFLASH signature scheme. It only works when the parameters are set to
q = 16, n = 96, α = r = 32, s = 1.

With these values the length of the hash of the message, that should be signed, must be 256 bits. For that reason we chose SHA-256 as the message digest.

The PFlashSignature can be used as follow:

Signature generation

  1. get instance of PFlashSignature Signature pflashSig = Registry.getSignature("pFLASH");
  2. initialize signing
    pflashSig.initSign(privateKey, secureRandom);
  3. sign message
    pflashSig.update(message.getBytes());
    byte[] signature = pflashSign.sign();

Signature verification

  1. initialize verifying
    pflashSign.initVerify(publicKey);
  2. verify the signature
    pflashSign.update(message.getBytes());
    boolean accepted = pflashSign.verify(signature);

Author:
Marian Hornschuch, Alexander Koller
See Also:
PFlashKeyPairGenerator

Field Summary
static java.lang.String OID
          OID of the algorithm
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
PFlashSignature()
          pFLASH Signature with SHA256
 
Method Summary
 void initSign(PrivateKey key, SecureRandom srandom)
          Initialize the signature algorithm for signing a message.
 void initVerify(PublicKey key)
          Initialize the signature algorithm for verifying a signature.
 void setParameters(AlgorithmParameterSpec params)
          Initialize this signature engine with specified parameter set (Not used)
 byte[] sign()
          Sign a message.
 void update(byte input)
          Feed a message byte to the message digest.
 void update(byte[] input, int inOff, int inLen)
          Feed an array of message bytes to the message digest.
 boolean verify(byte[] sigBytes)
          Verfify a signature.
 
Methods inherited from class de.flexiprovider.api.Signature
engineGetParameter, engineInitSign, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerify, engineVerify, initSign, sign, update, verify, verify, verify
 
Methods inherited from class java.security.SignatureSpi
clone, engineSign
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
OID of the algorithm
Constructor Detail

PFlashSignature

public PFlashSignature()
pFLASH Signature with SHA256

The default values for the parameters are :

degree of extension m=4
field polynomial of GF(2m)=X4 + X + 1
extension degree of E/K=96
α=32
r=32
s=1
Method Detail

initSign

public void initSign(PrivateKey key,
                     SecureRandom srandom)
              throws InvalidKeyException
Initialize the signature algorithm for signing a message.
Overrides:
initSign in class Signature
Parameters:
key - the private key of the signer
srandom - a source of randomness
Throws:
InvalidKeyException - if the key is not an instance of PFlashPrivateKey

initVerify

public void initVerify(PublicKey key)
                throws InvalidKeyException
Initialize the signature algorithm for verifying a signature.
Overrides:
initVerify in class Signature
Parameters:
key - the public key of the signer
Throws:
InvalidKeyException - if the public key is not an instance of PFlashPublicKey

setParameters

public void setParameters(AlgorithmParameterSpec params)
Initialize this signature engine with specified parameter set (Not used)
Overrides:
setParameters in class Signature
Parameters:
params - the parameters (not used)

update

public void update(byte input)
Feed a message byte to the message digest.
Overrides:
update in class Signature
Parameters:
input - the message byte

update

public void update(byte[] input,
                   int inOff,
                   int inLen)
Feed an array of message bytes to the message digest.
Overrides:
update in class Signature
Parameters:
input - array of message bytes
inOff - index of message start
inLen - number of message bytes

sign

public byte[] sign()
Sign a message.
Overrides:
sign in class Signature
Returns:
the signature

verify

public boolean verify(byte[] sigBytes)
Verfify a signature.
Overrides:
verify in class Signature
Parameters:
signature - the signature to be verified
Returns:
true if signature is valid, false otherwise