Files
webprofile-ref-project-v3/src/main/java/no/steras/opensamlbook/idp/IDPCredentials.java
srasmusson 45eae54018 tidy up
2016-05-09 00:00:23 +02:00

31 lines
887 B
Java

package no.steras.opensamlbook.idp;
import org.opensaml.security.credential.Credential;
import org.opensaml.security.credential.CredentialSupport;
import org.opensaml.security.crypto.KeySupport;
import java.security.*;
public class IDPCredentials {
private static final Credential credential;
static {
credential = generateCredential();
}
private static Credential generateCredential() {
try {
KeyPair keyPair = KeySupport.generateKeyPair("RSA", 1024, null);
return CredentialSupport.getSimpleCredential(keyPair.getPublic(), keyPair.getPrivate());
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e);
}
}
public static Credential getCredential() {
return credential;
}
}