Package com.browserup.bup.mitm
Class HostnameCertificateInfoGenerator
- java.lang.Object
-
- com.browserup.bup.mitm.HostnameCertificateInfoGenerator
-
- All Implemented Interfaces:
CertificateInfoGenerator
public class HostnameCertificateInfoGenerator extends java.lang.Object implements CertificateInfoGenerator
ACertificateInfoGeneratorthat uses only a hostname to populate a newCertificateInfo. The values in the upstream server's original X.509 certificate will be ignored.
-
-
Constructor Summary
Constructors Constructor Description HostnameCertificateInfoGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CertificateInfogenerate(java.util.List<java.lang.String> hostnames, java.security.cert.X509Certificate originalCertificate)Generate a certificate for the specified hostnames, optionally using parameters from the originalCertificate.protected java.time.InstantgetNotAfter()Returns the default Not After date for impersonated certificates.protected java.time.InstantgetNotBefore()Returns the default Not Before date for impersonated certificates.
-
-
-
Method Detail
-
generate
public CertificateInfo generate(java.util.List<java.lang.String> hostnames, java.security.cert.X509Certificate originalCertificate)
Description copied from interface:CertificateInfoGeneratorGenerate a certificate for the specified hostnames, optionally using parameters from the originalCertificate.- Specified by:
generatein interfaceCertificateInfoGenerator- Parameters:
hostnames- the hostnames to generate the certificate for, which may include wildcardsoriginalCertificate- original X.509 certificate sent by the upstream server, which may be null- Returns:
- CertificateInfo to be used to create an X509Certificate for the specified hostnames
-
getNotBefore
protected java.time.Instant getNotBefore()
Returns the default Not Before date for impersonated certificates. Defaults to the current date minus 1 year.- Returns:
- Instant
-
getNotAfter
protected java.time.Instant getNotAfter()
Returns the default Not After date for impersonated certificates. Defaults to the current date plus 1 year.- Returns:
- Instant
-
-