src/main/java/toy/crypto/PkiUtils.java
/**
     * Sign on a given message.
     * @param plainText the message to be signed
     * @return a string that encodes the signature
     */
Sign on a given message.
@param plainText the message to be signed
@return a string that encodes the signature
Sign on a given message . @param plainText the message to be signed @return a string that encodes the signature
static public String sign(String plainText) {
        synchronized (globalLock) {
            try {
                privateSignature.update(plainText.getBytes(UTF_8));
                byte[] signature = privateSignature.sign();
                return Base64.getEncoder().encodeToString(signature);
            } catch (Exception e) {
                logger.fatal("Unable to generate rsa keys", e);
            }
        }
        return null;
    }
static public String sign ( String plainText ) { synchronized ( globalLock ) { try { privateSignature . update ( plainText . getBytes ( UTF_8 ) ) ; byte [ ] signature = privateSignature . sign ( ) ; return Base64 . getEncoder ( ) . encodeToString ( signature ) ; } catch ( Exception e ) { logger . fatal ( "Unable to generate rsa keys" , e ) ; } } return null ; }
Sign on a given message.
Sign on a given message .