# File lib/puppet/sslcertificates/certificate.rb, line 180
180:   def mkselfsigned
181:     self.getkey unless @key
182: 
183:     raise Puppet::Error, "Cannot replace existing certificate" if @cert
184: 
185:     args = {
186:       :name => self.certname,
187:       :ttl => @ttl,
188:       :issuer => nil,
189:       :serial => 0x0,
190:       :publickey => @key.public_key
191:     }
192:     if @type
193:       args[:type] = @type
194:     else
195:       args[:type] = :server
196:     end
197:     @cert = SSLCertificates.mkcert(args)
198: 
199:     @cert.sign(@key, OpenSSL::Digest::SHA1.new) if @selfsign
200: 
201:     @cert
202:   end