/*
 * Copyright 2018 Scytl Secure Electronic Voting SA
 *
 * All rights reserved
 *
 * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
 */
package com.scytl.products.ov.sdm.application.service;

import java.security.KeyPair;
import java.security.PrivateKey;

import javax.annotation.PostConstruct;

import com.scytl.cryptolib.api.asymmetric.AsymmetricServiceAPI;
import com.scytl.cryptolib.api.exceptions.GeneralCryptoLibException;
import com.scytl.cryptolib.asymmetric.service.AsymmetricService;

public class KeyStoreServiceForTesting implements KeyStoreService {

    private PrivateKey privateKey;

    @PostConstruct
    public void initPrivateKey() throws GeneralCryptoLibException {

        AsymmetricServiceAPI service = new AsymmetricService();
        KeyPair keyPairForSigning = service.getKeyPairForSigning();
        privateKey = keyPairForSigning.getPrivate();
    }

    @Override
    public PrivateKey getPrivateKey() {
        return privateKey;
    }
}
