### Question:
CertificateHelper { @Nullable public static PrivateKey convertStringToPrivateKey (@Nullable final String sPrivateKey) throws GeneralSecurityException { if (StringHelper.hasNoText (sPrivateKey)) return null; String sRealPrivateKey = StringHelper.trimStart (sPrivateKey, BEGIN_PRIVATE_KEY); sRealPrivateKey = StringHelper.trimEnd (sRealPrivateKey, END_PRIVATE_KEY); sRealPrivateKey = StringHelper.getWithoutAnySpaces (sRealPrivateKey); final byte [] aPrivateKeyBytes = Base64.safeDecode (sRealPrivateKey); if (aPrivateKeyBytes == null) return null; final KeyFactory aKeyFactory = KeyFactory.getInstance ("RSA"); final PKCS8EncodedKeySpec aKeySpec = new PKCS8EncodedKeySpec (aPrivateKeyBytes); return aKeyFactory.generatePrivate (aKeySpec); } private  CertificateHelper(); @Nonnull static CertificateFactory getX509CertificateFactory(); @Nonnull static String getWithPEMHeader(@Nonnull final String sCertString); @Nullable static String getWithoutPEMHeader(@Nullable final String sCertificate); @Nullable static String getRFC1421CompliantString(@Nullable final String sCertificate, final boolean bIncludePEMHeader); @Nullable static String getRFC1421CompliantString(@Nullable final String sCertificate,
                                                  final boolean bIncludePEMHeader,
                                                  @Nonnull final String sLineSeparator); @Nullable static X509Certificate convertByteArrayToCertficate(@Nullable final byte [] aCertBytes); @Nullable static X509Certificate convertByteArrayToCertficateOrNull(@Nullable final byte [] aCertBytes); @Nullable static X509Certificate convertByteArrayToCertficateDirect(@Nullable final byte [] aCertBytes); @Nullable static X509Certificate convertStringToCertficate(@Nullable final String sCertString); @Nullable static X509Certificate convertStringToCertficateOrNull(@Nullable final String sCertString); @Nullable static byte [] convertCertificateStringToByteArray(@Nullable final String sCertificate); @Nonnull @Nonempty static String getPEMEncodedCertificate(@Nonnull final Certificate aCert); static boolean isCertificateValidPerNow(@Nonnull final X509Certificate aCert); @Nullable static PrivateKey convertStringToPrivateKey(@Nullable final String sPrivateKey); static final String BEGIN_CERTIFICATE; static final String END_CERTIFICATE; static final String BEGIN_CERTIFICATE_INVALID; static final String END_CERTIFICATE_INVALID; static final String BEGIN_PRIVATE_KEY; static final String END_PRIVATE_KEY; static final String CRLF; static final Charset CERT_CHARSET; }### Answer:
@Test @Ignore ("No key present") public void testParsePrivateKey () throws GeneralSecurityException { final PrivateKey pk = CertificateHelper.convertStringToPrivateKey ("test key here"); assertNotNull (pk); }