Generate secure public & private keys for Web Push notifications
For security, keys are generated server-side using Node.js web-push
library and never stored.
Keep this private key secure and never expose it in client-side code
Click the button to create a new VAPID key pair
Store them securely in your server configuration
Never expose the private key in client-side code
Use environment variables for production
This tool uses the web-push Node.js library to generate cryptographically secure VAPID key pairs:
webPush.generateVAPIDKeys()
methodThe server code is open source and available for inspection.
To use these keys in your Spring Boot application:
// application.properties
push.vapid.public-key=YOUR_PUBLIC_KEY
push.vapid.private-key=YOUR_PRIVATE_KEY
// Configuration class
@Configuration
public class WebPushConfig {
@Value("${push.vapid.public-key}")
private String publicKey;
@Value("${push.vapid.private-key}")
private String privateKey;
@Value("${push.vapid.subject}")
private String subject;
@Bean
public VAPIDKeys vapidKeys() {
return new VAPIDKeys(publicKey, privateKey, subject);
}
}
Never commit private keys to version control
Use process.env
or similar for production
Regularly rotate keys for enhanced security
Restrict access to keys to authorized personnel only
Algorithm
ECDSA P-256
Key Format
Base64 URL-safe
Key Size
256-bit
Standard
RFC 8292
Compatible with all major browsers including Chrome, Firefox, Edge, and Safari