コード例 #1
0
 /**
  * Compute an encrypted server public key signature using the Master Private Key.
  *
  * @param C_serverPublicKey Encrypted server public key.
  * @param masterPrivateKey Master Private Key.
  * @return Signature of the encrypted server public key.
  * @throws InvalidKeyException If master private key is invalid.
  */
 public byte[] computeServerPublicKeySignature(
     byte[] C_serverPublicKey, PrivateKey masterPrivateKey) throws InvalidKeyException {
   try {
     return signatureUtils.computeECDSASignature(C_serverPublicKey, masterPrivateKey);
   } catch (SignatureException ex) {
     Logger.getLogger(PowerAuthServerActivation.class.getName()).log(Level.SEVERE, null, ex);
   }
   return null;
 }
コード例 #2
0
 /**
  * Generate signature for the activation data. Activation data are constructed as a concatenation
  * of activationIdShort and activationOTP, both values are separated with the "-" character:
  *
  * <p>activationData = activationIdShort + "_" + activationOTP
  *
  * <p>Signature is then computed using the master private key.
  *
  * @param activationIdShort Short activation ID.
  * @param activationOTP Activation OTP value.
  * @param masterPrivateKey Master Private Key.
  * @return Signature of activation data using Master Private Key.
  * @throws InvalidKeyException In case Master Private Key is invalid.
  */
 public byte[] generateActivationSignature(
     String activationIdShort, String activationOTP, PrivateKey masterPrivateKey)
     throws InvalidKeyException {
   try {
     byte[] bytes = (activationIdShort + "-" + activationOTP).getBytes("UTF-8");
     byte[] signature = signatureUtils.computeECDSASignature(bytes, masterPrivateKey);
     return signature;
   } catch (UnsupportedEncodingException | SignatureException ex) {
     Logger.getLogger(PowerAuthServerActivation.class.getName()).log(Level.SEVERE, null, ex);
   }
   return null;
 }