List of usage examples for com.amazonaws.auth RSA privateKeyFromPKCS8
public static PrivateKey privateKeyFromPKCS8(byte[] pkcs8) throws InvalidKeySpecException
From source file:org.nuxeo.ecm.core.storage.sql.CloudFrontBinaryManager.java
License:Apache License
private static PrivateKey loadPrivateKey(String privateKeyPath) throws InvalidKeySpecException, IOException { if (privateKeyPath == null) { return null; }// w w w . j a v a2 s . com try (FileInputStream is = new FileInputStream(new File(privateKeyPath))) { if (privateKeyPath.toLowerCase().endsWith(".pem")) { return PEM.readPrivateKey(is); } if (privateKeyPath.toLowerCase().endsWith(".der")) { return RSA.privateKeyFromPKCS8(IOUtils.toByteArray(is)); } throw new AmazonClientException("Unsupported file type for private key"); } }